Workstations (Only the Stabilizer "works")

This commit is contained in:
Vos
2025-11-20 19:43:40 -06:00
parent c86d3f8b0e
commit eed75860b8
32 changed files with 946 additions and 8 deletions
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "acesbs:entropic_entangler"
}
],
"rolls": 1.0
}
]
}
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "acesbs:entropic_evicerator"
}
],
"rolls": 1.0
}
]
}
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "acesbs:entropic_stabilizer"
}
],
"rolls": 1.0
}
]
}
@@ -6,6 +6,9 @@
"acesbs:entropy_ore", "acesbs:entropy_ore",
"acesbs:deepslate_entropy_ore", "acesbs:deepslate_entropy_ore",
"acesbs:infernal_ashes_ore", "acesbs:infernal_ashes_ore",
"acesbs:endtropy_ore" "acesbs:endtropy_ore",
"acesbs:entropic_stabilizer",
"acesbs:entropic_evicerator",
"acesbs:entropic_entangler"
] ]
} }
@@ -5,6 +5,9 @@
"acesbs:endtropy_ore", "acesbs:endtropy_ore",
"acesbs:entropy_block", "acesbs:entropy_block",
"acesbs:stable_entropy_block", "acesbs:stable_entropy_block",
"acesbs:prisma_steel_block" "acesbs:prisma_steel_block",
"acesbs:entropic_stabilizer",
"acesbs:entropic_evicerator",
"acesbs:entropic_entangler"
] ]
} }
@@ -1,6 +1,7 @@
package com.acethewildfire.acesbs; package com.acethewildfire.acesbs;
import com.acethewildfire.acesbs.block.ModBlocks; import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.block.entity.ModBlockEntities;
import com.acethewildfire.acesbs.component.ModDataComponentTypes; import com.acethewildfire.acesbs.component.ModDataComponentTypes;
import com.acethewildfire.acesbs.effect.ModEffects; import com.acethewildfire.acesbs.effect.ModEffects;
import com.acethewildfire.acesbs.enchantment.ModEnchantmentEffects; import com.acethewildfire.acesbs.enchantment.ModEnchantmentEffects;
@@ -9,6 +10,7 @@ import com.acethewildfire.acesbs.entity.custom.FrenEntity;
import com.acethewildfire.acesbs.item.ModItemGroups; import com.acethewildfire.acesbs.item.ModItemGroups;
import com.acethewildfire.acesbs.item.ModItems; import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.potion.ModPotions; import com.acethewildfire.acesbs.potion.ModPotions;
import com.acethewildfire.acesbs.screen.ModScreenHandlers;
import com.acethewildfire.acesbs.sounds.ModSounds; import com.acethewildfire.acesbs.sounds.ModSounds;
import com.acethewildfire.acesbs.util.HammerUsageEvent; import com.acethewildfire.acesbs.util.HammerUsageEvent;
import com.acethewildfire.acesbs.util.UpdateRecipies; import com.acethewildfire.acesbs.util.UpdateRecipies;
@@ -52,6 +54,8 @@ public class AcesBS implements ModInitializer {
ModEnchantmentEffects.registerModEnchantments(); ModEnchantmentEffects.registerModEnchantments();
ModWorldGeneration.generateModWorldGen(); ModWorldGeneration.generateModWorldGen();
ModEntities.registerModEntities(); ModEntities.registerModEntities();
ModBlockEntities.registerBlockEntities();
ModScreenHandlers.registerScreenHandlers();
ModDataComponentTypes.registerDataComponentsTypes(); ModDataComponentTypes.registerDataComponentsTypes();
@@ -6,11 +6,15 @@ import com.acethewildfire.acesbs.entity.client.CombustibleLemonModel;
import com.acethewildfire.acesbs.entity.client.CombustibleLemonRenderer; import com.acethewildfire.acesbs.entity.client.CombustibleLemonRenderer;
import com.acethewildfire.acesbs.entity.client.FrenModel; import com.acethewildfire.acesbs.entity.client.FrenModel;
import com.acethewildfire.acesbs.entity.client.FrenRenderer; import com.acethewildfire.acesbs.entity.client.FrenRenderer;
import com.acethewildfire.acesbs.screen.ModScreenHandlers;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreen;
import com.acethewildfire.acesbs.util.ModModelPredicates; import com.acethewildfire.acesbs.util.ModModelPredicates;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
public class AcesBSClient implements ClientModInitializer { public class AcesBSClient implements ClientModInitializer {
@@ -31,5 +35,7 @@ public class AcesBSClient implements ClientModInitializer {
EntityModelLayerRegistry.registerModelLayer(CombustibleLemonModel.C_LEMON, CombustibleLemonModel::getTexturedModelData); EntityModelLayerRegistry.registerModelLayer(CombustibleLemonModel.C_LEMON, CombustibleLemonModel::getTexturedModelData);
EntityRendererRegistry.register(ModEntities.C_LEMON, CombustibleLemonRenderer::new); EntityRendererRegistry.register(ModEntities.C_LEMON, CombustibleLemonRenderer::new);
HandledScreens.register(ModScreenHandlers.ENTROPIC_STABILIZER_SCREEN_HANDLER, EntropicStabilizerScreen::new);
} }
} }
@@ -1,10 +1,7 @@
package com.acethewildfire.acesbs.block; package com.acethewildfire.acesbs.block;
import com.acethewildfire.acesbs.AcesBS; import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.block.custom.EntropyBlock; import com.acethewildfire.acesbs.block.custom.*;
import com.acethewildfire.acesbs.block.custom.EvilBlock;
import com.acethewildfire.acesbs.block.custom.StableEntropyBlock;
import com.acethewildfire.acesbs.block.custom.TobaccoCrop;
import com.acethewildfire.acesbs.sounds.ModSounds; import com.acethewildfire.acesbs.sounds.ModSounds;
import com.acethewildfire.acesbs.world.tree.ModBlockSaplingGenerator; import com.acethewildfire.acesbs.world.tree.ModBlockSaplingGenerator;
import com.mojang.serialization.MapCodec; import com.mojang.serialization.MapCodec;
@@ -85,6 +82,33 @@ public class ModBlocks {
.requiresTool() .requiresTool()
.sounds(BlockSoundGroup.LODESTONE))); .sounds(BlockSoundGroup.LODESTONE)));
public static final Block ENTROPIC_STABILIZER = registerBlock("entropic_stabilizer",
new EntropicStabilizer(
AbstractBlock.Settings.create()
.mapColor(MapColor.LIGHT_GRAY)
.strength(2.0F, 3.0F)
.sounds(BlockSoundGroup.METAL)
.requiresTool()
));
public static final Block ENTROPIC_EVICERATOR = registerBlock("entropic_evicerator",
new Block(
AbstractBlock.Settings.create()
.mapColor(MapColor.LIGHT_GRAY)
.strength(2.0F, 3.0F)
.sounds(BlockSoundGroup.METAL)
.requiresTool()
));
public static final Block ENTROPIC_ENTANGLER = registerBlock("entropic_entangler",
new Block(
AbstractBlock.Settings.create()
.mapColor(MapColor.LIGHT_GRAY)
.strength(2.0F, 3.0F)
.sounds(BlockSoundGroup.METAL)
.requiresTool()
));
public static final Block LEMONWOOD_LOG = registerBlock("lemonwood_log", public static final Block LEMONWOOD_LOG = registerBlock("lemonwood_log",
new PillarBlock(AbstractBlock.Settings.copy(Blocks.BIRCH_LOG))); new PillarBlock(AbstractBlock.Settings.copy(Blocks.BIRCH_LOG)));
public static final Block LEMONWOOD_WOOD = registerBlock("lemonwood_wood", public static final Block LEMONWOOD_WOOD = registerBlock("lemonwood_wood",
@@ -0,0 +1,99 @@
package com.acethewildfire.acesbs.block.custom;
import com.acethewildfire.acesbs.block.entity.custom.EntropicStabilizerEntity;
import com.mojang.serialization.MapCodec;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.ItemActionResult;
import net.minecraft.util.ItemScatterer;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
public class EntropicStabilizer extends BlockWithEntity implements BlockEntityProvider {
public static final DirectionProperty FACING = Properties.HORIZONTAL_FACING;
public static final MapCodec<EntropicStabilizer> CODEC = EntropicStabilizer.createCodec(EntropicStabilizer::new);
public EntropicStabilizer(Settings settings) {
super(settings);
setDefaultState(getStateManager().getDefaultState().with(FACING, Direction.NORTH));
}
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
return CODEC;
}
@Override
public @Nullable BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new EntropicStabilizerEntity(pos, state);
}
@Override
protected BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
if(state.getBlock() != newState.getBlock()) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if(blockEntity instanceof EntropicStabilizerEntity) {
ItemScatterer.spawn(world, pos, ((EntropicStabilizerEntity) blockEntity));
world.updateComparators(pos, this);
}
super.onStateReplaced(state, world, pos, newState, moved);
}
}
@Override
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if(world.getBlockEntity(pos) instanceof EntropicStabilizerEntity entropicStabilizerEntity) {
// if(entropicStabilizerEntity.isEmpty() && !stack.isEmpty()) {
// entropicStabilizerEntity.setStack(0, stack.copyWithCount(1));
// world.playSound(player, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 1f, 2f);
// stack.decrement(1);
//
// entropicStabilizerEntity.markDirty();
// world.updateListeners(pos, state, state, 0);
// }
// else if(!entropicStabilizerEntity.isEmpty() && stack.isEmpty() && !player.isSneaking()) {
// ItemStack stackOnPedestal = entropicStabilizerEntity.getStack(0);
// player.setStackInHand(Hand.MAIN_HAND, stackOnPedestal);
// world.playSound(player, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 1f, 1f);
// entropicStabilizerEntity.clear();
//
// entropicStabilizerEntity.markDirty();
// world.updateListeners(pos, state, state, 0);
// }
if(!player.isSneaking() && !world.isClient()) {
player.openHandledScreen(entropicStabilizerEntity);
}
}
return ItemActionResult.SUCCESS;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return getDefaultState().with(FACING, ctx.getHorizontalPlayerFacing().getOpposite());
}
}
@@ -0,0 +1,214 @@
package com.acethewildfire.acesbs.block.entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventories;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.Direction;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* A simple {@code SidedInventory} implementation with only default methods + an item list getter.
*
* <h2>Reading and writing to tags</h2>
* Use {@link Inventories#writeNbt(NbtCompound, DefaultedList, RegistryWrapper.WrapperLookup)} and
* {@link Inventories#readNbt(NbtCompound, DefaultedList, RegistryWrapper.WrapperLookup)}
* on {@linkplain #getItems() the item list}.
*
* License: <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>
* @author Juuz
*/
@FunctionalInterface
public interface ImplementedInventory extends SidedInventory {
/**
* Gets the item list of this inventory.
* Must return the same instance every time it's called.
*
* @return the item list
*/
DefaultedList<ItemStack> getItems();
/**
* Creates an inventory from the item list.
*
* @param items the item list
* @return a new inventory
*/
static ImplementedInventory of(DefaultedList<ItemStack> items) {
return () -> items;
}
/**
* Creates a new inventory with the size.
*
* @param size the inventory size
* @return a new inventory
*/
static ImplementedInventory ofSize(int size) {
return of(DefaultedList.ofSize(size, ItemStack.EMPTY));
}
// SidedInventory
/**
* Gets the available slots to automation on the side.
*
* <p>The default implementation returns an array of all slots.
*
* @param side the side
* @return the available slots
*/
@Override
default int[] getAvailableSlots(Direction side) {
int[] result = new int[getItems().size()];
for (int i = 0; i < result.length; i++) {
result[i] = i;
}
return result;
}
/**
* Returns true if the stack can be inserted in the slot at the side.
*
* <p>The default implementation returns true.
*
* @param slot the slot
* @param stack the stack
* @param side the side
* @return true if the stack can be inserted
*/
@Override
default boolean canInsert(int slot, ItemStack stack, @Nullable Direction side) {
return true;
}
/**
* Returns true if the stack can be extracted from the slot at the side.
*
* <p>The default implementation returns true.
*
* @param slot the slot
* @param stack the stack
* @param side the side
* @return true if the stack can be extracted
*/
@Override
default boolean canExtract(int slot, ItemStack stack, Direction side) {
return true;
}
// Inventory
/**
* Returns the inventory size.
*
* <p>The default implementation returns the size of {@link #getItems()}.
*
* @return the inventory size
*/
@Override
default int size() {
return getItems().size();
}
/**
* @return true if this inventory has only empty stacks, false otherwise
*/
@Override
default boolean isEmpty() {
for (int i = 0; i < size(); i++) {
ItemStack stack = getStack(i);
if (!stack.isEmpty()) {
return false;
}
}
return true;
}
/**
* Gets the item in the slot.
*
* @param slot the slot
* @return the item in the slot
*/
@Override
default ItemStack getStack(int slot) {
return getItems().get(slot);
}
/**
* Takes a stack of the size from the slot.
*
* <p>(default implementation) If there are less items in the slot than what are requested,
* takes all items in that slot.
*
* @param slot the slot
* @param count the item count
* @return a stack
*/
@Override
default ItemStack removeStack(int slot, int count) {
ItemStack result = Inventories.splitStack(getItems(), slot, count);
if (!result.isEmpty()) {
markDirty();
}
return result;
}
/**
* Removes the current stack in the {@code slot} and returns it.
*
* <p>The default implementation uses {@link Inventories#removeStack(List, int)}
*
* @param slot the slot
* @return the removed stack
*/
@Override
default ItemStack removeStack(int slot) {
return Inventories.removeStack(getItems(), slot);
}
/**
* Replaces the current stack in the {@code slot} with the provided stack.
*
* <p>If the stack is too big for this inventory ({@link Inventory#getMaxCountPerStack()}),
* it gets resized to this inventory's maximum amount.
*
* @param slot the slot
* @param stack the stack
*/
@Override
default void setStack(int slot, ItemStack stack) {
getItems().set(slot, stack);
if (stack.getCount() > getMaxCountPerStack()) {
stack.setCount(getMaxCountPerStack());
}
}
/**
* Clears {@linkplain #getItems() the item list}}.
*/
@Override
default void clear() {
getItems().clear();
}
@Override
default void markDirty() {
// Override if you want behavior.
}
@Override
default boolean canPlayerUse(PlayerEntity player) {
return true;
}
}
@@ -0,0 +1,23 @@
package com.acethewildfire.acesbs.block.entity;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.block.entity.custom.EntropicStabilizerEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class ModBlockEntities {
public static final BlockEntityType<EntropicStabilizerEntity> E_STABILIZER_BE =
Registry.register(Registries.BLOCK_ENTITY_TYPE, Identifier.of(AcesBS.MOD_ID, "e_stabilizer_be"),
BlockEntityType.Builder.create(EntropicStabilizerEntity::new, ModBlocks.ENTROPIC_STABILIZER).build(null));
public static void registerBlockEntities() {
AcesBS.LOGGER.info("Registering Block Entities for " + AcesBS.MOD_ID);
}
}
@@ -0,0 +1,113 @@
package com.acethewildfire.acesbs.block.entity.custom;
import com.acethewildfire.acesbs.block.custom.EntropicStabilizer;
import com.acethewildfire.acesbs.block.entity.ImplementedInventory;
import com.acethewildfire.acesbs.block.entity.ModBlockEntities;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreenHandler;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import org.jetbrains.annotations.Nullable;
public class EntropicStabilizerEntity extends BlockEntity implements ImplementedInventory, ExtendedScreenHandlerFactory<BlockPos> {
private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize(3, ItemStack.EMPTY);
private Direction facing;
public EntropicStabilizerEntity(BlockPos pos, BlockState state) {
super(ModBlockEntities.E_STABILIZER_BE, pos, state);
this.facing = state.get(EntropicStabilizer.FACING);
}
public Direction getFacing() {
return facing;
}
public void setFacing(Direction newFacing) {
this.facing = newFacing;
// sync to blockstate for rendering
if (world != null && !world.isClient) {
world.setBlockState(pos, getCachedState().with(EntropicStabilizer.FACING, newFacing), 3);
markDirty();
}
}
@Override
protected void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) {
super.writeNbt(nbt, registryLookup);
Inventories.writeNbt(nbt, inventory, registryLookup);
nbt.putInt("Facing", facing.getId());
}
@Override
protected void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) {
super.readNbt(nbt, registryLookup);
Inventories.readNbt(nbt, inventory, registryLookup);
this.facing = Direction.byId(nbt.getInt("Facing"));
}
@Override
public DefaultedList<ItemStack> getItems() {
return inventory;
}
@Override
public BlockPos getScreenOpeningData(ServerPlayerEntity serverPlayerEntity) {
return this.pos;
}
@Override
public Text getDisplayName() {
return Text.literal("Entropic Stabilizer");
}
@Override
public @Nullable ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) {
return new EntropicStabilizerScreenHandler(syncId, playerInventory, this.pos);
}
@Nullable
@Override
public Packet<ClientPlayPacketListener> toUpdatePacket() {
return BlockEntityUpdateS2CPacket.create(this);
}
@Override
public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registryLookup) {
return createNbt(registryLookup);
}
// public float getCookProgress() {
// int i = this.propertyDelegate.get(2);
// int j = this.propertyDelegate.get(3);
// return j != 0 && i != 0 ? MathHelper.clamp((float)i / (float)j, 0.0F, 1.0F) : 0.0F;
// }
//
// public float getFuelProgress() {
// int i = this.propertyDelegate.get(1);
// if (i == 0) {
// i = 200;
// }
//
// return MathHelper.clamp((float)this.propertyDelegate.get(0) / (float)i, 0.0F, 1.0F);
// }
public boolean canInsertIntoSlot(int index) {
return index != 1;
}
}
@@ -23,7 +23,10 @@ public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
.add(ModBlocks.ENTROPY_ORE) .add(ModBlocks.ENTROPY_ORE)
.add(ModBlocks.DEEPSLATE_ENTROPY_ORE) .add(ModBlocks.DEEPSLATE_ENTROPY_ORE)
.add(ModBlocks.INFERNAL_ASHES_ORE) .add(ModBlocks.INFERNAL_ASHES_ORE)
.add(ModBlocks.ENDTROPY_ORE); .add(ModBlocks.ENDTROPY_ORE)
.add(ModBlocks.ENTROPIC_STABILIZER)
.add(ModBlocks.ENTROPIC_EVICERATOR)
.add(ModBlocks.ENTROPIC_ENTANGLER);
getOrCreateTagBuilder(BlockTags.NEEDS_IRON_TOOL) getOrCreateTagBuilder(BlockTags.NEEDS_IRON_TOOL)
.add(ModBlocks.INFERNAL_ASHES_ORE); .add(ModBlocks.INFERNAL_ASHES_ORE);
getOrCreateTagBuilder(BlockTags.NEEDS_DIAMOND_TOOL) getOrCreateTagBuilder(BlockTags.NEEDS_DIAMOND_TOOL)
@@ -32,7 +35,10 @@ public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
.add(ModBlocks.ENDTROPY_ORE) .add(ModBlocks.ENDTROPY_ORE)
.add(ModBlocks.ENTROPY_BLOCK) .add(ModBlocks.ENTROPY_BLOCK)
.add(ModBlocks.STABLE_ENTROPY_BLOCK) .add(ModBlocks.STABLE_ENTROPY_BLOCK)
.add(ModBlocks.PRISMA_STEEL_BLOCK); .add(ModBlocks.PRISMA_STEEL_BLOCK)
.add(ModBlocks.ENTROPIC_STABILIZER)
.add(ModBlocks.ENTROPIC_EVICERATOR)
.add(ModBlocks.ENTROPIC_ENTANGLER);
getOrCreateTagBuilder(BlockTags.AXE_MINEABLE) getOrCreateTagBuilder(BlockTags.AXE_MINEABLE)
.add(ModBlocks.LEMONWOOD_PLANKS) .add(ModBlocks.LEMONWOOD_PLANKS)
.add(ModBlocks.LEMONWOOD_WALL) .add(ModBlocks.LEMONWOOD_WALL)
@@ -58,6 +58,9 @@ public class ModLootTableProvider extends FabricBlockLootTableProvider {
addDrop(ModBlocks.INFERNAL_ASHES_BLOCK); addDrop(ModBlocks.INFERNAL_ASHES_BLOCK);
addDrop(ModBlocks.STABLE_ENTROPY_BLOCK); addDrop(ModBlocks.STABLE_ENTROPY_BLOCK);
addDrop(ModBlocks.PRISMA_STEEL_BLOCK); addDrop(ModBlocks.PRISMA_STEEL_BLOCK);
addDrop(ModBlocks.ENTROPIC_STABILIZER);
addDrop(ModBlocks.ENTROPIC_EVICERATOR);
addDrop(ModBlocks.ENTROPIC_ENTANGLER);
addDropWithSilkTouch(ModBlocks.CRYSTAL_ENTROPY); addDropWithSilkTouch(ModBlocks.CRYSTAL_ENTROPY);
addDropWithSilkTouch(ModBlocks.CRYSTAL_ENTROPY_PANE); addDropWithSilkTouch(ModBlocks.CRYSTAL_ENTROPY_PANE);
@@ -50,6 +50,10 @@ public class ModItemGroups {
entries.add(ModBlocks.PRISMA_STEEL_BLOCK); entries.add(ModBlocks.PRISMA_STEEL_BLOCK);
entries.add(ModBlocks.ENTROPIC_STABILIZER);
entries.add(ModBlocks.ENTROPIC_EVICERATOR);
entries.add(ModBlocks.ENTROPIC_ENTANGLER);
entries.add(ModBlocks.LIZARD_PLANKS); entries.add(ModBlocks.LIZARD_PLANKS);
entries.add(ModBlocks.LIZARD_BUTTON); entries.add(ModBlocks.LIZARD_BUTTON);
@@ -0,0 +1,21 @@
package com.acethewildfire.acesbs.screen;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreenHandler;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
public class ModScreenHandlers {
public static final ScreenHandlerType<EntropicStabilizerScreenHandler> ENTROPIC_STABILIZER_SCREEN_HANDLER =
Registry.register(Registries.SCREEN_HANDLER, Identifier.of(AcesBS.MOD_ID, "entropic_stabilizer_screen_handler"),
new ExtendedScreenHandlerType<>(EntropicStabilizerScreenHandler::new, BlockPos.PACKET_CODEC));
public static void registerScreenHandlers() {
AcesBS.LOGGER.info("Registering Screen Handlers for " + AcesBS.MOD_ID);
}
}
@@ -0,0 +1,39 @@
package com.acethewildfire.acesbs.screen.custom;
import com.acethewildfire.acesbs.AcesBS;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
public class EntropicStabilizerScreen extends HandledScreen<EntropicStabilizerScreenHandler> {
public static final Identifier GUI_TEXTURE =
Identifier.of(AcesBS.MOD_ID, "textures/gui/entropic_stabilizer/entropic_stabilizer_gui.png");
public EntropicStabilizerScreen(EntropicStabilizerScreenHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, title);
}
@Override
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
RenderSystem.setShaderTexture(0, GUI_TEXTURE);
int x = (width - backgroundWidth) / 2;
int y = (height - backgroundHeight) / 2;
context.drawTexture(GUI_TEXTURE, x, y, 0, 0, backgroundWidth, backgroundHeight);
}
@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
drawMouseoverTooltip(context, mouseX, mouseY);
}
}
@@ -0,0 +1,108 @@
package com.acethewildfire.acesbs.screen.custom;
import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.screen.ModScreenHandlers;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.math.BlockPos;
public class EntropicStabilizerScreenHandler extends ScreenHandler {
private final Inventory inventory;
public EntropicStabilizerScreenHandler(int syncId, PlayerInventory playerInventory, BlockPos pos) {
this(syncId, playerInventory, playerInventory.player.getWorld().getBlockEntity(pos));
}
public EntropicStabilizerScreenHandler(int syncId, PlayerInventory playerInventory, BlockEntity blockEntity) {
super(ModScreenHandlers.ENTROPIC_STABILIZER_SCREEN_HANDLER, syncId);
this.inventory = ((Inventory) blockEntity);
this.addSlot(new Slot(inventory, 0, 56, 17)); //Item
this.addSlot(new Slot(inventory, 1, 56, 53)); //Fuel
this.addSlot(new Slot(inventory, 2, 116, 35)); // Output
addPlayerInventory(playerInventory);
addPlayerHotbar(playerInventory);
}
@Override
public ItemStack quickMove(PlayerEntity player, int invSlot) {
ItemStack newStack = ItemStack.EMPTY;
Slot slot = this.slots.get(invSlot);
if (slot != null && slot.hasStack()) {
ItemStack originalStack = slot.getStack();
newStack = originalStack.copy();
if (invSlot == 2) {
if (!this.insertItem(originalStack, 3, 39, true)) {
return ItemStack.EMPTY;
}
slot.onQuickTransfer(originalStack, newStack);
} else if (invSlot != 1 && invSlot != 0) {
if (this.isStabilizable(originalStack)) {
if (!this.insertItem(originalStack, 0, 1, false)) {
return ItemStack.EMPTY;
}
} else if (this.isFuel(originalStack)) {
if (!this.insertItem(originalStack, 1, 2, false)) {
return ItemStack.EMPTY;
}
} else if (invSlot >= 3 && invSlot < 30) {
if (!this.insertItem(originalStack, 30, 39, false)) {
return ItemStack.EMPTY;
}
} else if (invSlot >= 30 && invSlot < 39 && !this.insertItem(originalStack, 3, 30, false)) {
return ItemStack.EMPTY;
}
} else if (!this.insertItem(originalStack, 3, 39, false)) {
return ItemStack.EMPTY;
}
if (originalStack.isEmpty()) {
slot.setStack(ItemStack.EMPTY);
} else {
slot.markDirty();
}
if (newStack.getCount() == originalStack.getCount()) {
return ItemStack.EMPTY;
}
slot.onTakeItem(player, originalStack);
}
return newStack;
}
protected boolean isStabilizable(ItemStack itemStack) {
return itemStack.isOf(ModItems.RAW_ENTROPY) || itemStack.isOf(ModItems.RAW_ENDTROPY);
}
protected boolean isFuel(ItemStack itemStack) {
return itemStack.isOf(Items.SNOWBALL);
}
@Override
public boolean canUse(PlayerEntity player) {
return this.inventory.canPlayerUse(player);
}
private void addPlayerInventory(PlayerInventory playerInventory) {
for (int i = 0; i < 3; ++i) {
for (int l = 0; l < 9; ++l) {
this.addSlot(new Slot(playerInventory, l + i * 9 + 9, 8 + l * 18, 84 + i * 18));
}
}
}
private void addPlayerHotbar(PlayerInventory playerInventory) {
for (int i = 0; i < 9; ++i) {
this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142));
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "acesbs:block/entropic_entangler"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "acesbs:block/entropic_evicerator"
}
}
}
@@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "acesbs:block/entropic_stabilizer" },
"facing=south": { "model": "acesbs:block/entropic_stabilizer", "y": 180 },
"facing=west": { "model": "acesbs:block/entropic_stabilizer", "y": 270 },
"facing=east": { "model": "acesbs:block/entropic_stabilizer", "y": 90 }
}
}
@@ -99,6 +99,9 @@
"block.acesbs.infernal_ashes_ore": "Infernal Ashes Ore", "block.acesbs.infernal_ashes_ore": "Infernal Ashes Ore",
"block.acesbs.endtropy_ore": "Endtropic Ore", "block.acesbs.endtropy_ore": "Endtropic Ore",
"block.acesbs.stable_entropy_block": "Block of Stabilized Entropy", "block.acesbs.stable_entropy_block": "Block of Stabilized Entropy",
"block.acesbs.entropic_stabilizer": "Entropic Stabilizer",
"block.acesbs.entropic_evicerator": "Entropic Evicerator",
"block.acesbs.entropic_entangler": "Entropic Entangler",
"block.acesbs.lizard_planks": "Lizard Planks", "block.acesbs.lizard_planks": "Lizard Planks",
"block.acesbs.lizard_button": "Lizard Button", "block.acesbs.lizard_button": "Lizard Button",
@@ -0,0 +1,58 @@
{
"format_version": "1.21.6",
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"0": "acesbs:block/entropic_entangler",
"particle": "acesbs:block/entropic_entangler"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 4, 4], "texture": "#0"},
"east": {"uv": [0, 4, 4, 8], "texture": "#0"},
"south": {"uv": [4, 0, 8, 4], "texture": "#0"},
"west": {"uv": [4, 4, 8, 8], "texture": "#0"},
"up": {"uv": [4, 12, 0, 8], "texture": "#0"},
"down": {"uv": [12, 0, 8, 4], "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": {
"translation": [0, 3.25, -5.5],
"scale": [0.25, 0.25, 0.25]
},
"fixed": {
"scale": [0.5, 0.5, 0.5]
}
}
}
@@ -0,0 +1,58 @@
{
"format_version": "1.21.6",
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"0": "acesbs:block/entropic_evicerator",
"particle": "acesbs:block/entropic_evicerator"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 4, 4], "texture": "#0"},
"east": {"uv": [0, 4, 4, 8], "texture": "#0"},
"south": {"uv": [4, 0, 8, 4], "texture": "#0"},
"west": {"uv": [4, 4, 8, 8], "texture": "#0"},
"up": {"uv": [4, 12, 0, 8], "texture": "#0"},
"down": {"uv": [12, 0, 8, 4], "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": {
"translation": [0, 3.25, -5.5],
"scale": [0.25, 0.25, 0.25]
},
"fixed": {
"scale": [0.5, 0.5, 0.5]
}
}
}
@@ -0,0 +1,58 @@
{
"format_version": "1.21.6",
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"0": "acesbs:block/entropic_stabilizer",
"particle": "acesbs:block/entropic_stabilizer"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 4, 4], "texture": "#0"},
"east": {"uv": [0, 4, 4, 8], "texture": "#0"},
"south": {"uv": [4, 0, 8, 4], "texture": "#0"},
"west": {"uv": [4, 4, 8, 8], "texture": "#0"},
"up": {"uv": [4, 12, 0, 8], "texture": "#0"},
"down": {"uv": [12, 0, 8, 4], "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": {
"translation": [0, 3.25, -5.5],
"scale": [0.25, 0.25, 0.25]
},
"fixed": {
"scale": [0.5, 0.5, 0.5]
}
}
}
@@ -0,0 +1,3 @@
{
"parent": "acesbs:block/entropic_entangler"
}
@@ -0,0 +1,3 @@
{
"parent": "acesbs:block/entropic_evicerator"
}
@@ -0,0 +1,3 @@
{
"parent": "acesbs:block/entropic_stabilizer"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB