so much fucking work!!!

This commit is contained in:
TheBlackfurGuy 2021-12-04 18:14:36 +01:00
parent 4e48c81484
commit 3f994e48b4
9 changed files with 281 additions and 47 deletions

View file

@ -4,9 +4,9 @@
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>FABRIC</platformType>
<platformType>MIXIN</platformType>
<platformType>MCP</platformType>
<platformType>FABRIC</platformType>
</autoDetectTypes>
</configuration>
</facet>

View file

@ -4,9 +4,9 @@
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>FABRIC</platformType>
<platformType>MIXIN</platformType>
<platformType>MCP</platformType>
<platformType>FABRIC</platformType>
</autoDetectTypes>
</configuration>
</facet>

View file

@ -4,14 +4,16 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="uhm what?">
<change afterPath="$PROJECT_DIR$/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/data/tastytoasters/loot_tables/blocks/toaster.json" afterDir="false" />
<list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="added toaster block hardness and tool requirement">
<change afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/models/block/toaster_filled.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/tastytoasters.main.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules/tastytoasters.main.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/tastytoasters.test.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules/tastytoasters.test.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Temp/loot_tables/blocks/toasters.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Temp/minecraft/tags/blocks/mineable/pickaxe.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Temp/minecraft/tags/blocks/needs_stone_tool.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/data/minecraft/tags/blocks/needs_stone_tool.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/Tastytoasters.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/Tastytoasters.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/blockstates/toaster.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/blockstates/toaster.json" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -51,13 +53,7 @@
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
<item name="tastytoasters" type="f1a62948:ProjectNode" />
<item name="Tasks" type="e4a08cd1:TasksNode" />
<item name="fabric" type="c8890929:TasksNode$1" />
</path>
<path>
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
<item name="tastytoasters" type="f1a62948:ProjectNode" />
<item name="Tasks" type="e4a08cd1:TasksNode" />
<item name="other" type="c8890929:TasksNode$1" />
<item name="documentation" type="c8890929:TasksNode$1" />
</path>
</expand>
<select />
@ -99,18 +95,62 @@
</key>
</component>
<component name="RunManager" selected="Application.Minecraft Client">
<configuration name="/Users/blackfur/IdeaProjects/tastytoasters" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<configuration name="tastytoasters [genSources]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="genSources" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
<configuration name="tastytoasters [jar]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="jar" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
<configuration name="tastytoasters [javadoc]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="javadoc" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
@ -162,9 +202,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Gradle.tastytoasters [jar]" />
<item itemvalue="Gradle.tastytoasters [javadoc]" />
<item itemvalue="Gradle.tastytoasters [genSources]" />
<item itemvalue="Gradle.tastytoasters [runClient]" />
<item itemvalue="Gradle.tastytoasters [migrateMappings]" />
<item itemvalue="Gradle./Users/blackfur/IdeaProjects/tastytoasters" />
</list>
</recent_temporary>
</component>
@ -191,7 +233,14 @@
<option name="project" value="LOCAL" />
<updated>1638614632820</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="added toaster block hardness and tool requirement">
<created>1638615794540</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1638615794540</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -209,6 +258,7 @@
<MESSAGE value="Basic setup" />
<MESSAGE value="Upgraded to 1.18" />
<MESSAGE value="uhm what?" />
<option name="LAST_COMMIT_MESSAGE" value="uhm what?" />
<MESSAGE value="added toaster block hardness and tool requirement" />
<option name="LAST_COMMIT_MESSAGE" value="added toaster block hardness and tool requirement" />
</component>
</project>

View file

@ -3,6 +3,10 @@ plugins {
id 'maven-publish'
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
@ -29,31 +33,18 @@ dependencies {
processResources {
inputs.property "version", project.version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
@ -62,7 +53,7 @@ java {
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
rename { "${it}_${project.archivesBaseName}"}
}
}
@ -70,13 +61,7 @@ jar {
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
from components.java
}
}

View file

@ -1,10 +1,13 @@
package blackfur.tastytoasters;
import blackfur.tastytoasters.block.ToasterBlock;
import blackfur.tastytoasters.block.ToasterBlockEntity;
import blackfur.tastytoasters.items.*;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
@ -21,6 +24,8 @@ public class Tastytoasters implements ModInitializer {
public static final ToasterBlock TOASTER_BLOCK = new ToasterBlock(FabricBlockSettings.of(Material.METAL).hardness(4.0f).requiresTool());
public static BlockEntityType<ToasterBlockEntity> TOASTER_BLOCK_ENTITY;
@Override
public void onInitialize() {
Registry.register(Registry.ITEM, new Identifier("tastytoasters", "raw_toast"), RAW_TOAST_ITEM);
@ -31,5 +36,7 @@ public class Tastytoasters implements ModInitializer {
Registry.register(Registry.BLOCK, new Identifier("tastytoasters", "toaster"), TOASTER_BLOCK);
Registry.register(Registry.ITEM, new Identifier("tastytoasters", "toaster"), new BlockItem(TOASTER_BLOCK, new Item.Settings().group(ItemGroup.FOOD)));
TOASTER_BLOCK_ENTITY = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier("tastytoasters", "toaster_entity"), FabricBlockEntityTypeBuilder.create(ToasterBlockEntity::new, TOASTER_BLOCK).build(null));
}
}

View file

@ -1,9 +1,80 @@
package blackfur.tastytoasters.block;
import net.minecraft.block.Block;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.function.BooleanBiFunction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
public class ToasterBlock extends HorizontalFacingBlock implements BlockEntityProvider {
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
public static final BooleanProperty TOASTING = BooleanProperty.of("toasting");
public class ToasterBlock extends Block {
public ToasterBlock(Settings settings) {
super(settings);
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
this.setDefaultState(this.stateManager.getDefaultState().with(TOASTING, false));
}
public BlockState getPlacementState(ItemPlacementContext ctx) {
return this.getDefaultState().with(FACING, ctx.getPlayerFacing().getOpposite());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING).add(TOASTING);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
if (state.get(TOASTING)) {
switch (state.get(FACING)) {
case NORTH:
case SOUTH: return VoxelShapes.combine(
VoxelShapes.cuboid((1f / 16f * 3), (1f / 16f * 0), (1f / 16f * 1), (1f / 16f * 13), (1f / 16f * 8), (1f / 16f * 15)),
VoxelShapes.combine(
VoxelShapes.cuboid((1f / 16f * 5), (1f / 16f * 8), (1f / 16f * 3), (1f / 16f * 7), (1f / 16f * 10), (1f / 16f * 13)),
VoxelShapes.cuboid((1f / 16f * 9), (1f / 16f * 8), (1f / 16f * 3), (1f / 16f * 11), (1f / 16f * 10), (1f / 16f * 13)),
BooleanBiFunction.OR
),
BooleanBiFunction.OR
);
case WEST:
case EAST: return VoxelShapes.combine(
VoxelShapes.cuboid((1f / 16f * 1), (1f / 16f * 0), (1f / 16f * 3), (1f / 16f * 15), (1f / 16f * 8), (1f / 16f * 13)),
VoxelShapes.combine(
VoxelShapes.cuboid((1f / 16f * 3), (1f / 16f * 8), (1f / 16f * 5), (1f / 16f * 13), (1f / 16f * 10), (1f / 16f * 7)),
VoxelShapes.cuboid((1f / 16f * 3), (1f / 16f * 8), (1f / 16f * 9), (1f / 16f * 13), (1f / 16f * 10), (1f / 16f * 11)),
BooleanBiFunction.OR
),
BooleanBiFunction.OR
);
}
} else {
switch (state.get(FACING)) {
case NORTH:
case SOUTH:
return VoxelShapes.cuboid((1f / 16f * 3), (1f / 16f * 0), (1f / 16f * 1), (1f / 16f * 13), (1f / 16f * 8), (1f / 16f * 15));
case EAST:
case WEST:
return VoxelShapes.cuboid((1f / 16f * 1), (1f / 16f * 0), (1f / 16f * 3), (1f / 16f * 15), (1f / 16f * 8), (1f / 16f * 13));
}
}
return null;
}
@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return null;
}
}

View file

@ -0,0 +1,12 @@
package blackfur.tastytoasters.block;
import blackfur.tastytoasters.Tastytoasters;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
public class ToasterBlockEntity extends BlockEntity {
public ToasterBlockEntity(BlockPos pos, BlockState state) {
super(Tastytoasters.TOASTER_BLOCK_ENTITY, pos, state);
}
}

View file

@ -1,5 +1,34 @@
{
"variants": {
"": { "model": "tastytoasters:block/toaster"}
"facing=east,toasting=false": {
"model": "tastytoasters:block/toaster",
"y": 90
},
"facing=north,toasting=false": {
"model": "tastytoasters:block/toaster"
},
"facing=south,toasting=false": {
"model": "tastytoasters:block/toaster",
"y": 180
},
"facing=west,toasting=false": {
"model": "tastytoasters:block/toaster",
"y": 270
},
"facing=east,toasting=true": {
"model": "tastytoasters:block/toaster_filled",
"y": 90
},
"facing=north,toasting=true": {
"model": "tastytoasters:block/toaster_filled"
},
"facing=south,toasting=true": {
"model": "tastytoasters:block/toaster_filled",
"y": 180
},
"facing=west,toasting=true": {
"model": "tastytoasters:block/toaster_filled",
"y": 270
}
}
}

View file

@ -0,0 +1,80 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "tastytoasters:block/toaster_filled",
"particle": "tastytoasters:block/toaster"
},
"elements": [
{
"from": [3, 0, 1],
"to": [13, 8, 15],
"faces": {
"north": {"uv": [0, 0, 5, 4], "texture": "#0"},
"east": {"uv": [10, 4, 14, 11], "rotation": 270, "texture": "#0"},
"south": {"uv": [5, 0, 10, 4], "texture": "#0"},
"west": {"uv": [10, 4, 14, 11], "rotation": 270, "texture": "#0"},
"up": {"uv": [0, 4, 5, 11], "texture": "#0"},
"down": {"uv": [5, 4, 10, 11], "texture": "#0"}
}
},
{
"from": [9, 8, 3],
"to": [11, 10, 13],
"faces": {
"north": {"uv": [1, 5, 2, 6], "texture": "#0"},
"east": {"uv": [1, 5, 2, 10], "rotation": 270, "texture": "#0"},
"south": {"uv": [1, 9, 2, 10], "texture": "#0"},
"west": {"uv": [1, 5, 2, 10], "rotation": 90, "texture": "#0"},
"up": {"uv": [1, 5, 2, 10], "texture": "#0"},
"down": {"uv": [1, 5, 2, 10], "texture": "#0"}
}
},
{
"from": [5, 8, 3],
"to": [7, 10, 13],
"faces": {
"north": {"uv": [1, 9, 2, 10], "texture": "#0"},
"east": {"uv": [1, 5, 2, 10], "rotation": 90, "texture": "#0"},
"south": {"uv": [1, 5, 2, 6], "texture": "#0"},
"west": {"uv": [1, 5, 2, 10], "rotation": 270, "texture": "#0"},
"up": {"uv": [1, 5, 2, 10], "rotation": 180, "texture": "#0"},
"down": {"uv": [1, 5, 2, 10], "rotation": 180, "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 225, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, 3, 0],
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 225, 0],
"scale": [0.625, 0.625, 0.625]
},
"head": {
"rotation": [0, 180, 0],
"translation": [0, 13, 7]
},
"fixed": {
"scale": [0.5, 0.5, 0.5]
}
}
}