Update uncrafter block model

This commit is contained in:
Zontreck 2024-03-03 21:06:43 -07:00
parent 8f02c19d55
commit cee3028d3b
7 changed files with 143 additions and 102 deletions

View file

@ -1,11 +1,28 @@
package dev.zontreck.otemod.blocks; package dev.zontreck.otemod.blocks;
import dev.zontreck.otemod.blocks.entity.CompressionChamberBlockEntity;
import dev.zontreck.otemod.blocks.entity.ModEntities;
import dev.zontreck.otemod.blocks.entity.UncrafterBlockEntity;
import dev.zontreck.otemod.networking.ModMessages;
import dev.zontreck.otemod.networking.packets.EnergySyncS2CPacket;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.HorizontalDirectionalBlock; import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
public class UncrafterBlock extends HorizontalDirectionalBlock implements EntityBlock public class UncrafterBlock extends HorizontalDirectionalBlock implements EntityBlock
@ -17,6 +34,69 @@ public class UncrafterBlock extends HorizontalDirectionalBlock implements Entity
@Nullable @Nullable
@Override @Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) { public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return null; return new UncrafterBlockEntity(blockPos, blockState);
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_49915_) {
super.createBlockStateDefinition(p_49915_);
p_49915_.add(FACING);
}
@Override
public RenderShape getRenderShape(BlockState p_60550_) {
return RenderShape.MODEL;
}
@Override
public InteractionResult use(BlockState state, Level lvl, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit)
{
if(!lvl.isClientSide())
{
BlockEntity be = lvl.getBlockEntity(pos);
if(be instanceof UncrafterBlockEntity entity)
{
NetworkHooks.openScreen(((ServerPlayer)player), entity, pos);
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);
}else{
throw new IllegalStateException("Our container is missing!");
}
}
return InteractionResult.sidedSuccess(lvl.isClientSide);
}
@Override
public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pMovedByPiston) {
if(pState.getBlock() != pNewState.getBlock())
{
BlockEntity be = pLevel.getBlockEntity(pPos);
if(be instanceof UncrafterBlockEntity)
{
((UncrafterBlockEntity)be).doDrop();
}
}
super.onRemove(pState, pLevel, pPos, pNewState, pMovedByPiston);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, BlockState pState, BlockEntityType<T> pBlockEntityType) {
return createTickerHelper(pBlockEntityType, ModEntities.UNCRAFTER.get(), UncrafterBlockEntity::tick);
}
protected static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> pServerType, BlockEntityType<E> pClientType, BlockEntityTicker<? super E> pTicker) {
return pClientType == pServerType ? (BlockEntityTicker<A>) pTicker : null;
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
return defaultBlockState().setValue(FACING, pContext.getHorizontalDirection());
} }
} }

View file

@ -75,73 +75,6 @@ public class ModBlockStatesProvider extends BlockStateProvider {
stairBlock(ModBlocks.DIRTY_GREEN_POOL_TILE_STAIRS, ModBlocks.DIRTY_GREEN_POOL_TILE); stairBlock(ModBlocks.DIRTY_GREEN_POOL_TILE_STAIRS, ModBlocks.DIRTY_GREEN_POOL_TILE);
slabBlock(ModBlocks.DIRTY_GREEN_POOL_TILE_SLAB, ModBlocks.DIRTY_GREEN_POOL_TILE); slabBlock(ModBlocks.DIRTY_GREEN_POOL_TILE_SLAB, ModBlocks.DIRTY_GREEN_POOL_TILE);
ResourceLocation[] clinkerBlock = new ResourceLocation[]{
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture3"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture4"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture5"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture6"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_texture7")
};
ResourceLocation[] clinkerStainedBlock = new ResourceLocation[]{
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture3"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture4"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture5"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture6"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/clinker_brick/clinker_brick_stained_texture7")
};
ResourceLocation[] slagBricks = new ResourceLocation[]{
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture3"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture4"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture5"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture6"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/slag_brick/slag_brick_texture7")
};
ResourceLocation[] rebarConcrete = new ResourceLocation[] {
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture3"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture4"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture5"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture6"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_texture7")
};
ResourceLocation[] rebarConcreteTile = new ResourceLocation[] {
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture3"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture4"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture5"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture6"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/concrete/rebar_concrete_tile_texture7")
};
ResourceLocation[] panzerglass = new ResourceLocation[]{
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/glass/panzerglass_block_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/glass/panzerglass_block_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/glass/panzerglass_block_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/glass/panzerglass_block_texture3")
};
ResourceLocation[] oldIndustrialWood = new ResourceLocation[]{
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture3"),
};
} }

View file

@ -78,6 +78,8 @@ public class ModItems {
public static final RegistryObject<Item> GREEN_BRICK = CreativeModeTabs.addToOTEModTab(ITEMS.register("green_brick", ()->new Item(new Item.Properties()))); public static final RegistryObject<Item> GREEN_BRICK = CreativeModeTabs.addToOTEModTab(ITEMS.register("green_brick", ()->new Item(new Item.Properties())));
public static final RegistryObject<Item> PARTIAL_ITEM = CreativeModeTabs.addToOTEModTab(ITEMS.register("partial_item", PartialItem::new));
//public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties()))); //public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties())));

View file

@ -0,0 +1,26 @@
package dev.zontreck.otemod.items;
import dev.zontreck.libzontreck.util.ChatHelpers;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class PartialItem extends Item
{
int uncraftSteps = 0;
public PartialItem() {
super (new Properties().fireResistant());
}
@Override
public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> tooltip, TooltipFlag p_41424_) {
tooltip.add(ChatHelpers.macro("!Yellow!This is a partially deconstructed item."));
tooltip.add(ChatHelpers.macro("!Dark_Red!Steps remaining to uncraft: [0]", "!Yellow!" + uncraftSteps));
}
}

File diff suppressed because one or more lines are too long

View file

@ -20,8 +20,8 @@
} }
}, },
{ {
"from": [5, 11, -1], "from": [5, 11, -0.5],
"to": [11, 12, 17], "to": [11, 12, 16.5],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "texture": "#1"},
@ -32,8 +32,8 @@
} }
}, },
{ {
"from": [-1, 4, 5], "from": [-0.5, 4, 5],
"to": [17, 5, 11], "to": [16.5, 5, 11],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "rotation": 180, "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "rotation": 180, "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"},
@ -44,8 +44,8 @@
} }
}, },
{ {
"from": [-1, 11, 5], "from": [-0.5, 11, 5],
"to": [17, 12, 11], "to": [16.5, 12, 11],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "rotation": 180, "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "rotation": 180, "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"},
@ -56,8 +56,8 @@
} }
}, },
{ {
"from": [-1, 4, 4], "from": [-0.5, 4, 4],
"to": [17, 12, 5], "to": [16.5, 12, 5],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "texture": "#1"},
@ -68,8 +68,8 @@
} }
}, },
{ {
"from": [-1, 4, 11], "from": [-0.5, 4, 11],
"to": [17, 12, 12], "to": [16.5, 12, 12],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "texture": "#1"},
@ -80,8 +80,8 @@
} }
}, },
{ {
"from": [11, 4, -1], "from": [11, 4, -0.5],
"to": [12, 12, 17], "to": [12, 12, 16.5],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "texture": "#1"},
@ -92,8 +92,8 @@
} }
}, },
{ {
"from": [5, 4, -1], "from": [5, 4, -0.5],
"to": [11, 5, 17], "to": [11, 5, 16.5],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "rotation": 270, "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "texture": "#1"},
@ -104,8 +104,8 @@
} }
}, },
{ {
"from": [4, 4, -1], "from": [4, 4, -0.5],
"to": [5, 12, 17], "to": [5, 12, 16.5],
"faces": { "faces": {
"north": {"uv": [6, 11, 11, 12], "texture": "#1"}, "north": {"uv": [6, 11, 11, 12], "texture": "#1"},
"east": {"uv": [6, 11, 11, 12], "texture": "#1"}, "east": {"uv": [6, 11, 11, 12], "texture": "#1"},
@ -118,7 +118,7 @@
{ {
"name": "grid", "name": "grid",
"from": [2, 16, 2], "from": [2, 16, 2],
"to": [14, 18, 14], "to": [14, 16.75, 14],
"faces": { "faces": {
"north": {"uv": [3, 3, 13, 4], "texture": "#2"}, "north": {"uv": [3, 3, 13, 4], "texture": "#2"},
"east": {"uv": [3, 3, 13, 4], "texture": "#2"}, "east": {"uv": [3, 3, 13, 4], "texture": "#2"},
@ -129,8 +129,8 @@
} }
}, },
{ {
"from": [6, 12, -1], "from": [6, 12, -0.5],
"to": [10, 13, 17], "to": [10, 13, 16.5],
"faces": { "faces": {
"north": {"uv": [6, 3, 10, 4], "texture": "#1"}, "north": {"uv": [6, 3, 10, 4], "texture": "#1"},
"east": {"uv": [6, 3, 7, 4], "texture": "#1"}, "east": {"uv": [6, 3, 7, 4], "texture": "#1"},
@ -141,8 +141,8 @@
} }
}, },
{ {
"from": [3, 15, -1], "from": [3, 15, -0.5],
"to": [13, 17, 17], "to": [13, 16.5, 16.5],
"faces": { "faces": {
"north": {"uv": [3, 0, 13, 2], "texture": "#2"}, "north": {"uv": [3, 0, 13, 2], "texture": "#2"},
"east": {"uv": [3, 0, 13, 2], "texture": "#2"}, "east": {"uv": [3, 0, 13, 2], "texture": "#2"},
@ -153,8 +153,8 @@
} }
}, },
{ {
"from": [4, 14, -1], "from": [4, 14, -0.5],
"to": [12, 15, 17], "to": [12, 15, 16.5],
"faces": { "faces": {
"north": {"uv": [4, 1, 12, 2], "texture": "#1"}, "north": {"uv": [4, 1, 12, 2], "texture": "#1"},
"east": {"uv": [4, 1, 5, 2], "texture": "#1"}, "east": {"uv": [4, 1, 5, 2], "texture": "#1"},
@ -165,8 +165,8 @@
} }
}, },
{ {
"from": [5, 13, -1], "from": [5, 13, -0.5],
"to": [11, 14, 17], "to": [11, 14, 16.5],
"faces": { "faces": {
"north": {"uv": [5, 2, 11, 3], "texture": "#1"}, "north": {"uv": [5, 2, 11, 3], "texture": "#1"},
"east": {"uv": [5, 2, 6, 3], "texture": "#1"}, "east": {"uv": [5, 2, 6, 3], "texture": "#1"},
@ -177,8 +177,8 @@
} }
}, },
{ {
"from": [-1, 12, 6], "from": [-0.5, 12, 6],
"to": [17, 13, 10], "to": [16.5, 13, 10],
"faces": { "faces": {
"north": {"uv": [6, 3, 7, 4], "texture": "#1"}, "north": {"uv": [6, 3, 7, 4], "texture": "#1"},
"east": {"uv": [6, 3, 10, 4], "texture": "#1"}, "east": {"uv": [6, 3, 10, 4], "texture": "#1"},
@ -189,8 +189,8 @@
} }
}, },
{ {
"from": [-1, 15, 3], "from": [-0.5, 15, 3],
"to": [17, 17, 13], "to": [16.5, 16.5, 13],
"faces": { "faces": {
"north": {"uv": [3, 0, 13, 2], "texture": "#2"}, "north": {"uv": [3, 0, 13, 2], "texture": "#2"},
"east": {"uv": [3, 0, 13, 2], "texture": "#2"}, "east": {"uv": [3, 0, 13, 2], "texture": "#2"},
@ -201,8 +201,8 @@
} }
}, },
{ {
"from": [-1, 14, 4], "from": [-0.5, 14, 4],
"to": [17, 15, 12], "to": [16.5, 15, 12],
"faces": { "faces": {
"north": {"uv": [4, 1, 5, 2], "texture": "#1"}, "north": {"uv": [4, 1, 5, 2], "texture": "#1"},
"east": {"uv": [4, 1, 12, 2], "texture": "#1"}, "east": {"uv": [4, 1, 12, 2], "texture": "#1"},
@ -213,8 +213,8 @@
} }
}, },
{ {
"from": [-1, 13, 5], "from": [-0.5, 13, 5],
"to": [17, 14, 11], "to": [16.5, 14, 11],
"faces": { "faces": {
"north": {"uv": [5, 2, 6, 3], "texture": "#1"}, "north": {"uv": [5, 2, 6, 3], "texture": "#1"},
"east": {"uv": [5, 2, 11, 3], "texture": "#1"}, "east": {"uv": [5, 2, 11, 3], "texture": "#1"},
@ -225,7 +225,6 @@
} }
} }
], ],
"display": {},
"groups": [ "groups": [
0, 0,
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B