Stabilizer and Eviscerator

This commit is contained in:
Vos
2026-01-31 21:12:38 -06:00
parent 829468755b
commit f5ca1ad4c0
48 changed files with 839 additions and 281 deletions
@@ -1,32 +0,0 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_endtropy_ore": {
"conditions": {
"items": [
{
"items": "acesbs:endtropy_ore"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "acesbs:stable_endtropy_from_blasting_endtropy_ore"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_endtropy_ore"
]
],
"rewards": {
"recipes": [
"acesbs:stable_endtropy_from_blasting_endtropy_ore"
]
}
}
@@ -1,32 +0,0 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_raw_endtropy": {
"conditions": {
"items": [
{
"items": "acesbs:raw_endtropy"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "acesbs:stable_endtropy_from_blasting_raw_endtropy"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_raw_endtropy"
]
],
"rewards": {
"recipes": [
"acesbs:stable_endtropy_from_blasting_raw_endtropy"
]
}
}
@@ -1,32 +0,0 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_deepslate_entropy_ore": {
"conditions": {
"items": [
{
"items": "acesbs:deepslate_entropy_ore"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "acesbs:stable_entropy_from_blasting_deepslate_entropy_ore"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_deepslate_entropy_ore"
]
],
"rewards": {
"recipes": [
"acesbs:stable_entropy_from_blasting_deepslate_entropy_ore"
]
}
}
@@ -1,32 +0,0 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_entropy_ore": {
"conditions": {
"items": [
{
"items": "acesbs:entropy_ore"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "acesbs:stable_entropy_from_blasting_entropy_ore"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_entropy_ore"
]
],
"rewards": {
"recipes": [
"acesbs:stable_entropy_from_blasting_entropy_ore"
]
}
}
@@ -1,32 +0,0 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_raw_entropy": {
"conditions": {
"items": [
{
"items": "acesbs:raw_entropy"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "acesbs:stable_entropy_from_blasting_raw_entropy"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_raw_entropy"
]
],
"rewards": {
"recipes": [
"acesbs:stable_entropy_from_blasting_raw_entropy"
]
}
}
@@ -11,7 +11,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "acesbs:entropic_evicerator"
"name": "acesbs:entropic_eviscerator"
}
],
"rolls": 1.0
@@ -1,13 +0,0 @@
{
"type": "minecraft:blasting",
"category": "misc",
"cookingtime": 2000,
"experience": 0.5,
"group": "stable_endtropy",
"ingredient": {
"item": "acesbs:endtropy_ore"
},
"result": {
"id": "acesbs:stable_endtropy"
}
}
@@ -1,13 +0,0 @@
{
"type": "minecraft:blasting",
"category": "misc",
"cookingtime": 2000,
"experience": 0.5,
"group": "stable_endtropy",
"ingredient": {
"item": "acesbs:raw_endtropy"
},
"result": {
"id": "acesbs:stable_endtropy"
}
}
@@ -1,13 +0,0 @@
{
"type": "minecraft:blasting",
"category": "misc",
"cookingtime": 2000,
"experience": 0.5,
"group": "stable_entropy",
"ingredient": {
"item": "acesbs:deepslate_entropy_ore"
},
"result": {
"id": "acesbs:stable_entropy"
}
}
@@ -1,13 +0,0 @@
{
"type": "minecraft:blasting",
"category": "misc",
"cookingtime": 2000,
"experience": 0.5,
"group": "stable_entropy",
"ingredient": {
"item": "acesbs:entropy_ore"
},
"result": {
"id": "acesbs:stable_entropy"
}
}
@@ -1,13 +0,0 @@
{
"type": "minecraft:blasting",
"category": "misc",
"cookingtime": 2000,
"experience": 0.5,
"group": "stable_entropy",
"ingredient": {
"item": "acesbs:raw_entropy"
},
"result": {
"id": "acesbs:stable_entropy"
}
}
@@ -8,7 +8,7 @@
"acesbs:infernal_ashes_ore",
"acesbs:endtropy_ore",
"acesbs:entropic_stabilizer",
"acesbs:entropic_evicerator",
"acesbs:entropic_eviscerator",
"acesbs:entropic_entangler"
]
}
@@ -7,7 +7,7 @@
"acesbs:stable_entropy_block",
"acesbs:prisma_steel_block",
"acesbs:entropic_stabilizer",
"acesbs:entropic_evicerator",
"acesbs:entropic_eviscerator",
"acesbs:entropic_entangler"
]
}
@@ -7,6 +7,7 @@ import com.acethewildfire.acesbs.entity.client.CombustibleLemonRenderer;
import com.acethewildfire.acesbs.entity.client.FrenModel;
import com.acethewildfire.acesbs.entity.client.FrenRenderer;
import com.acethewildfire.acesbs.screen.ModScreenHandlers;
import com.acethewildfire.acesbs.screen.custom.EntropicEvisceratorScreen;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreen;
import com.acethewildfire.acesbs.util.ModModelPredicates;
import net.fabricmc.api.ClientModInitializer;
@@ -37,5 +38,6 @@ public class AcesBSClient implements ClientModInitializer {
EntityRendererRegistry.register(ModEntities.C_LEMON, CombustibleLemonRenderer::new);
HandledScreens.register(ModScreenHandlers.ENTROPIC_STABILIZER_SCREEN_HANDLER, EntropicStabilizerScreen::new);
HandledScreens.register(ModScreenHandlers.ENTROPIC_EVISCERATOR_SCREEN_HANDLER, EntropicEvisceratorScreen::new);
}
}
@@ -8,24 +8,14 @@ import com.mojang.serialization.MapCodec;
import net.minecraft.block.*;
import net.minecraft.block.enums.NoteBlockInstrument;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import org.jetbrains.annotations.Nullable;
import java.util.function.ToIntFunction;
@@ -91,8 +81,8 @@ public class ModBlocks {
.requiresTool()
));
public static final Block ENTROPIC_EVICERATOR = registerBlock("entropic_evicerator",
new Block(
public static final Block ENTROPIC_EVISCERATOR = registerBlock("entropic_eviscerator",
new EntropicEviscerator(
AbstractBlock.Settings.create()
.mapColor(MapColor.LIGHT_GRAY)
.strength(2.0F, 3.0F)
@@ -0,0 +1,95 @@
package com.acethewildfire.acesbs.block.custom;
import com.acethewildfire.acesbs.block.entity.ModBlockEntities;
import com.acethewildfire.acesbs.block.entity.custom.EntropicEvisceratorEntity;
import com.mojang.serialization.MapCodec;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.NamedScreenHandlerFactory;
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 EntropicEviscerator extends BlockWithEntity implements BlockEntityProvider {
public static final DirectionProperty FACING = Properties.HORIZONTAL_FACING;
public static final MapCodec<EntropicEviscerator> CODEC = EntropicEviscerator.createCodec(EntropicEviscerator::new);
public EntropicEviscerator(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 EntropicEvisceratorEntity(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 EntropicEvisceratorEntity) {
ItemScatterer.spawn(world, pos, ((EntropicEvisceratorEntity) 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.isClient) {
NamedScreenHandlerFactory screenHandlerFactory = ((EntropicEvisceratorEntity) world.getBlockEntity(pos));
if (screenHandlerFactory != null) {
player.openHandledScreen(screenHandlerFactory);
}
}
return ItemActionResult.SUCCESS;
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
if(world.isClient()) {
return null;
}
return validateTicker(type, ModBlockEntities.E_EVISCERATOR_BE,
(world1, pos, state1, blockEntity) -> blockEntity.tick(world1, pos, state1));
}
@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());
}
}
@@ -11,8 +11,6 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.NamedScreenHandlerFactory;
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;
@@ -2,8 +2,8 @@ package com.acethewildfire.acesbs.block.entity;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.block.entity.custom.EntropicEvisceratorEntity;
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;
@@ -14,6 +14,9 @@ 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 final BlockEntityType<EntropicEvisceratorEntity> E_EVISCERATOR_BE =
Registry.register(Registries.BLOCK_ENTITY_TYPE, Identifier.of(AcesBS.MOD_ID, "e_eviscerator_be"),
BlockEntityType.Builder.create(EntropicEvisceratorEntity::new, ModBlocks.ENTROPIC_EVISCERATOR).build(null));
public static void registerBlockEntities() {
AcesBS.LOGGER.info("Registering Block Entities for " + AcesBS.MOD_ID);
@@ -0,0 +1,270 @@
package com.acethewildfire.acesbs.block.entity.custom;
import com.acethewildfire.acesbs.block.custom.EntropicEviscerator;
import com.acethewildfire.acesbs.block.entity.ImplementedInventory;
import com.acethewildfire.acesbs.block.entity.ModBlockEntities;
import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.recipe.EntropicEvisceratorRecipe;
import com.acethewildfire.acesbs.recipe.EntropicEvisceratorRecipeInput;
import com.acethewildfire.acesbs.recipe.ModRecipies;
import com.acethewildfire.acesbs.screen.custom.EntropicEvisceratorScreenHandler;
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.recipe.RecipeEntry;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.screen.PropertyDelegate;
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 net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
public class EntropicEvisceratorEntity extends BlockEntity implements ImplementedInventory, ExtendedScreenHandlerFactory<BlockPos> {
private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize(3, ItemStack.EMPTY);
private Direction facing;
private static final int INPUT_SLOT = 0;
private static final int FUEL_SLOT = 1;
private static final int OUTPUT_SLOT = 2;
private static final int FUEL_PROGRESS = 0;
private static final int FUEL_MAX_PROGRESS = 1;
private static final int EVISCERATE_PROGRESS = 2;
private static final int EVISCERATE_MAX_PROGRESS = 3;
private int fuel_progress = -1;
private int fuel_max_progress = 400;
private int eviscerate_progress = 0;
private int eviscerate_max_progress = 200;
protected final PropertyDelegate propertyDelegate;
public EntropicEvisceratorEntity(BlockPos pos, BlockState state) {
super(ModBlockEntities.E_EVISCERATOR_BE, pos, state);
this.facing = state.get(EntropicEviscerator.FACING);
this.propertyDelegate = new PropertyDelegate() {
@Override
public int get(int index) {
return switch (index) {
case 0 -> EntropicEvisceratorEntity.this.fuel_progress;
case 1 -> EntropicEvisceratorEntity.this.fuel_max_progress;
case 2 -> EntropicEvisceratorEntity.this.eviscerate_progress;
case 3 -> EntropicEvisceratorEntity.this.eviscerate_max_progress;
default -> 0;
};
}
@Override
public void set(int index, int value) {
switch (index) {
case 0 -> EntropicEvisceratorEntity.this.fuel_progress = value;
case 1 -> EntropicEvisceratorEntity.this.fuel_max_progress = value;
case 2 -> EntropicEvisceratorEntity.this.eviscerate_progress = value;
case 3 -> EntropicEvisceratorEntity.this.eviscerate_max_progress = value;
}
}
@Override
public int size() {
return 4;
}
};
}
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(EntropicEviscerator.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());
nbt.putInt("eviscerator.fuel_progress", fuel_progress);
nbt.putInt("eviscerator.fuel_max_progress", fuel_max_progress);
nbt.putInt("eviscerator.eviscerate_progress", eviscerate_progress);
nbt.putInt("eviscerator.eviscerate_max_progress", eviscerate_max_progress);
}
@Override
protected void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) {
Inventories.readNbt(nbt, inventory, registryLookup);
this.facing = Direction.byId(nbt.getInt("Facing"));
this.fuel_progress = nbt.getInt("eviscerator.fuel_progress");
this.fuel_max_progress = nbt.getInt("eviscerator.fuel_max_progress");
this.eviscerate_progress = nbt.getInt("eviscerator.eviscerate_progress");
this.eviscerate_max_progress = nbt.getInt("eviscerator.eviscerate_max_progress");
super.readNbt(nbt, registryLookup);
}
@Override
public DefaultedList<ItemStack> getItems() {
return inventory;
}
@Override
public BlockPos getScreenOpeningData(ServerPlayerEntity serverPlayerEntity) {
return this.pos;
}
@Override
public Text getDisplayName() {
return Text.translatable("block.acesbs.entropic_eviscerator");
}
@Override
public @Nullable ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) {
return new EntropicEvisceratorScreenHandler(syncId, playerInventory, this, propertyDelegate);
}
public float getCookProgress() {
int i = this.propertyDelegate.get(EVISCERATE_PROGRESS);
int j = this.propertyDelegate.get(EVISCERATE_MAX_PROGRESS);
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(FUEL_MAX_PROGRESS);
if (i == 0) {
i = 200;
}
return MathHelper.clamp((float)this.propertyDelegate.get(FUEL_PROGRESS) / (float) i, 0.0F, 1.0F);
}
// public boolean canInsertIntoSlot(int index) {
// return index != 1;
// }
public void tick(World world, BlockPos pos, BlockState state) {
if(hasRecipe()) {
if (hasFuel() || hasUnfinishedFuel()){
if (this.fuel_progress == -1){
// No fuel has been used yet
consumeFuel();
resetFuelProgress();
}
increaseCraftingProgress();
markDirty(world, pos, state);
if(hasCraftingFinished()) {
craftItem();
resetProgress();
}
if(hasFuel() && hasFuelFinished()) {
consumeFuel();
resetFuelProgress();
}
}
} else {
resetProgress();
}
}
private boolean hasFuel() {
return this.getStack(FUEL_SLOT).isOf(ModItems.STABLE_ENTROPY);
}
private boolean hasUnfinishedFuel() {
return this.fuel_progress > -1 && !hasFuelFinished();
}
private void resetProgress() {
this.eviscerate_progress = 0;
this.eviscerate_max_progress = 200;
}
private void resetFuelProgress() {
this.fuel_progress = 0;
this.fuel_max_progress = 400;
}
private void craftItem() {
Optional<RecipeEntry<EntropicEvisceratorRecipe>> recipe = getCurrentRecipe();
ItemStack output = recipe.get().value().output();
this.removeStack(INPUT_SLOT, 1);
this.setStack(OUTPUT_SLOT, new ItemStack(output.getItem(),
this.getStack(OUTPUT_SLOT).getCount() + output.getCount()));
}
private void consumeFuel() {
this.setStack(FUEL_SLOT, new ItemStack(this.getStack(FUEL_SLOT).getItem(),
this.getStack(FUEL_SLOT).getCount() - 1));
}
private boolean hasCraftingFinished() {
return this.eviscerate_progress >= this.eviscerate_max_progress;
}
private boolean hasFuelFinished() {
return this.fuel_progress >= this.fuel_max_progress;
}
private void increaseCraftingProgress() {
this.eviscerate_progress++;
this.fuel_progress++;
}
private boolean hasRecipe() {
Optional<RecipeEntry<EntropicEvisceratorRecipe>> recipe = getCurrentRecipe();
if (recipe.isEmpty()){ return false; }
ItemStack output = recipe.get().value().output();
return canInsertAmountIntoOutputSlot(output.getCount()) && canInsertItemIntoOutputSlot(output);
}
private Optional<RecipeEntry<EntropicEvisceratorRecipe>> getCurrentRecipe() {
return this.getWorld().getRecipeManager()
.getFirstMatch(ModRecipies.ENTROPIC_EVISCERATOR_TYPE, new EntropicEvisceratorRecipeInput(inventory.get(INPUT_SLOT)), this.getWorld());
}
private boolean canInsertItemIntoOutputSlot(ItemStack output) {
return this.getStack(OUTPUT_SLOT).isEmpty() || this.getStack(OUTPUT_SLOT).getItem() == output.getItem();
}
private boolean canInsertAmountIntoOutputSlot(int count) {
int maxCount = this.getStack(OUTPUT_SLOT).isEmpty() ? 64 : this.getStack(OUTPUT_SLOT).getMaxCount();
int currentCount = this.getStack(OUTPUT_SLOT).getCount();
return maxCount >= currentCount + count;
}
@Nullable
@Override
public Packet<ClientPlayPacketListener> toUpdatePacket() {
return BlockEntityUpdateS2CPacket.create(this);
}
@Override
public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registryLookup) {
return createNbt(registryLookup);
}
}
@@ -164,7 +164,7 @@ public class EntropicStabilizerEntity extends BlockEntity implements Implemented
public void tick(World world, BlockPos pos, BlockState state) {
if(hasRecipe()) {
if (hasFuel()){
if (hasFuel() || hasUnfinishedFuel()){
if (this.fuel_progress == -1){
// No fuel has been used yet
consumeFuel();
@@ -178,7 +178,7 @@ public class EntropicStabilizerEntity extends BlockEntity implements Implemented
resetProgress();
}
if(hasFuelFinished()) {
if(hasFuel() && hasFuelFinished()) {
consumeFuel();
resetFuelProgress();
}
@@ -189,7 +189,11 @@ public class EntropicStabilizerEntity extends BlockEntity implements Implemented
}
private boolean hasFuel() {
return this.getStack(FUEL_SLOT).isOf(Items.SNOWBALL);
return this.getStack(FUEL_SLOT).isOf(Items.BLUE_ICE);
}
private boolean hasUnfinishedFuel() {
return this.fuel_progress > -1 && !hasFuelFinished();
}
private void resetProgress() {
@@ -234,7 +238,7 @@ public class EntropicStabilizerEntity extends BlockEntity implements Implemented
if (recipe.isEmpty()){ return false; }
ItemStack output = new ItemStack(ModItems.STABLE_ENTROPY, 1);
ItemStack output = recipe.get().value().output();
return canInsertAmountIntoOutputSlot(output.getCount()) && canInsertItemIntoOutputSlot(output);
}
@@ -1,8 +1,10 @@
package com.acethewildfire.acesbs.compat;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.recipe.EntropicEvisceratorRecipe;
import com.acethewildfire.acesbs.recipe.EntropicStabilizerRecipe;
import com.acethewildfire.acesbs.recipe.ModRecipies;
import com.acethewildfire.acesbs.screen.custom.EntropicEvisceratorScreen;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreen;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
@@ -11,25 +13,28 @@ import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry;
import me.shedaniel.rei.api.common.util.EntryStacks;
import java.awt.*;
public class AcesBSREIClient implements REIClientPlugin {
@Override
public void registerCategories(CategoryRegistry registry) {
registry.add(new EntropicStabilizerCategory());
registry.addWorkstations(EntropicStabilizerCategory.ENTROPIC_STABILIZER, EntryStacks.of(ModBlocks.ENTROPIC_STABILIZER));
registry.add(new EntropicEvisceratorCategory());
registry.addWorkstations(EntropicEvisceratorCategory.ENTROPIC_EVISCERATOR, EntryStacks.of(ModBlocks.ENTROPIC_EVISCERATOR));
}
@Override
public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(EntropicStabilizerRecipe.class, ModRecipies.ENTROPIC_STABILIZER_TYPE, EntropicStabilizerDisplay::new);
registry.registerRecipeFiller(EntropicEvisceratorRecipe.class, ModRecipies.ENTROPIC_EVISCERATOR_TYPE, EntropicEvisceratorDisplay::new);
}
@Override
public void registerScreens(ScreenRegistry registry) {
registry.registerClickArea(screen -> new Rectangle(((screen.width - 176) / 2) + 78,
((screen.height - 166) / 2) + 30, 20, 25 ), EntropicStabilizerScreen.class, EntropicStabilizerCategory.ENTROPIC_STABILIZER);
registry.registerClickArea(screen -> new Rectangle(((screen.width - 176) / 2) + 78,
((screen.height - 166) / 2) + 30, 20, 25 ), EntropicEvisceratorScreen.class, EntropicEvisceratorCategory.ENTROPIC_EVISCERATOR);
}
}
@@ -0,0 +1,63 @@
package com.acethewildfire.acesbs.compat;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.item.ModItems;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import java.util.LinkedList;
import java.util.List;
public class EntropicEvisceratorCategory implements DisplayCategory<BasicDisplay> {
public static final Identifier GUI_TEXTURE =
Identifier.of(AcesBS.MOD_ID, "textures/gui/entropic_eviscerator/entropic_eviscerator_gui_rei.png");
public static final CategoryIdentifier<EntropicEvisceratorDisplay> ENTROPIC_EVISCERATOR =
CategoryIdentifier.of(AcesBS.MOD_ID, "entropic_eviscerator");
@Override
public CategoryIdentifier<? extends BasicDisplay> getCategoryIdentifier() {
return ENTROPIC_EVISCERATOR;
}
@Override
public Text getTitle() {
return Text.translatable("block.acesbs.entropic_eviscerator");
}
@Override
public Renderer getIcon() {
return EntryStacks.of(ModBlocks.ENTROPIC_EVISCERATOR.asItem().getDefaultStack());
}
@Override
public List<Widget> setupDisplay(BasicDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 87, bounds.getCenterY() - 41);
List<Widget> widgets = new LinkedList<>();
widgets.add(Widgets.createTexturedWidget(GUI_TEXTURE, new Rectangle(startPoint.x, startPoint.y, 175, 82)));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 80, startPoint.y + 17)).entries(display.getInputEntries().get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 8, startPoint.y + 17)).entries(EntryIngredient.of(EntryStacks.of(ModItems.STABLE_ENTROPY))));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 80, startPoint.y + 53)).entries(display.getOutputEntries().get(0)).markOutput());
return widgets;
}
@Override
public int getDisplayHeight() {
return 90;
}
}
@@ -0,0 +1,29 @@
package com.acethewildfire.acesbs.compat;
import com.acethewildfire.acesbs.recipe.EntropicEvisceratorRecipe;
import com.acethewildfire.acesbs.recipe.EntropicStabilizerRecipe;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.recipe.RecipeEntry;
import java.util.List;
public class EntropicEvisceratorDisplay extends BasicDisplay {
private RecipeEntry<?> recipe;
private float xp;
private double cookTime;
public EntropicEvisceratorDisplay(RecipeEntry<EntropicEvisceratorRecipe> recipe){
super(
List.of(EntryIngredients.ofIngredient(recipe.value().getIngredients().get(0))),
List.of(EntryIngredient.of(EntryStacks.of(recipe.value().getResult(null)))));
}
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return EntropicEvisceratorCategory.ENTROPIC_EVISCERATOR;
}
}
@@ -51,7 +51,7 @@ public class EntropicStabilizerCategory implements DisplayCategory<BasicDisplay>
widgets.add(Widgets.createTexturedWidget(GUI_TEXTURE, new Rectangle(startPoint.x, startPoint.y, 175, 82)));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 56, startPoint.y + 17)).entries(display.getInputEntries().get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 56, startPoint.y + 53)).entries(EntryIngredient.of(EntryStacks.of(Items.SNOWBALL))));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 56, startPoint.y + 53)).entries(EntryIngredient.of(EntryStacks.of(Items.BLUE_ICE))));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 116, startPoint.y + 35)).entries(display.getOutputEntries().get(0)).markOutput());
return widgets;
@@ -25,7 +25,7 @@ public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
.add(ModBlocks.INFERNAL_ASHES_ORE)
.add(ModBlocks.ENDTROPY_ORE)
.add(ModBlocks.ENTROPIC_STABILIZER)
.add(ModBlocks.ENTROPIC_EVICERATOR)
.add(ModBlocks.ENTROPIC_EVISCERATOR)
.add(ModBlocks.ENTROPIC_ENTANGLER);
getOrCreateTagBuilder(BlockTags.NEEDS_IRON_TOOL)
.add(ModBlocks.INFERNAL_ASHES_ORE);
@@ -37,7 +37,7 @@ public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
.add(ModBlocks.STABLE_ENTROPY_BLOCK)
.add(ModBlocks.PRISMA_STEEL_BLOCK)
.add(ModBlocks.ENTROPIC_STABILIZER)
.add(ModBlocks.ENTROPIC_EVICERATOR)
.add(ModBlocks.ENTROPIC_EVISCERATOR)
.add(ModBlocks.ENTROPIC_ENTANGLER);
getOrCreateTagBuilder(BlockTags.AXE_MINEABLE)
.add(ModBlocks.LEMONWOOD_PLANKS)
@@ -1,15 +1,12 @@
package com.acethewildfire.acesbs.datagen;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.block.custom.TobaccoCrop;
import com.acethewildfire.acesbs.item.ModItems;
import com.acethewildfire.acesbs.util.ModTags;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.Item;
@@ -35,7 +32,6 @@ import net.minecraft.predicate.item.EnchantmentPredicate;
import net.minecraft.predicate.item.EnchantmentsPredicate;
import net.minecraft.predicate.item.ItemPredicate;
import net.minecraft.predicate.item.ItemSubPredicateTypes;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
@@ -59,7 +55,7 @@ public class ModLootTableProvider extends FabricBlockLootTableProvider {
addDrop(ModBlocks.STABLE_ENTROPY_BLOCK);
addDrop(ModBlocks.PRISMA_STEEL_BLOCK);
addDrop(ModBlocks.ENTROPIC_STABILIZER);
addDrop(ModBlocks.ENTROPIC_EVICERATOR);
addDrop(ModBlocks.ENTROPIC_EVISCERATOR);
addDrop(ModBlocks.ENTROPIC_ENTANGLER);
addDropWithSilkTouch(ModBlocks.CRYSTAL_ENTROPY);
@@ -51,7 +51,7 @@ public class ModItemGroups {
entries.add(ModBlocks.PRISMA_STEEL_BLOCK);
entries.add(ModBlocks.ENTROPIC_STABILIZER);
entries.add(ModBlocks.ENTROPIC_EVICERATOR);
entries.add(ModBlocks.ENTROPIC_EVISCERATOR);
entries.add(ModBlocks.ENTROPIC_ENTANGLER);
entries.add(ModBlocks.LIZARD_PLANKS);
@@ -2,12 +2,8 @@ package com.acethewildfire.acesbs.item;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.item.custom.CombustibleLemon;
import com.acethewildfire.acesbs.item.custom.*;
import com.acethewildfire.acesbs.entity.ModEntities;
import com.acethewildfire.acesbs.item.custom.HammerItem;
import com.acethewildfire.acesbs.item.custom.ModArmorItem;
import com.acethewildfire.acesbs.item.custom.OracleLemon;
import com.acethewildfire.acesbs.item.custom.Wand;
import com.acethewildfire.acesbs.potion.ModPotions;
import com.acethewildfire.acesbs.sounds.ModSounds;
import net.minecraft.client.gui.screen.Screen;
@@ -20,11 +16,13 @@ import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.resource.featuretoggle.FeatureFlags;
import net.minecraft.text.RawFilteredPair;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import java.util.List;
import java.util.Optional;
public class ModItems {
public static final Item ORACLE_LEMON = registerItem("oracle_lemon", new OracleLemon(new Item.Settings().component(DataComponentTypes.POTION_CONTENTS, new PotionContentsComponent(ModPotions.LEMON))));
@@ -0,0 +1,85 @@
package com.acethewildfire.acesbs.recipe;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.item.ItemStack;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.RecipeType;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
public record EntropicEvisceratorRecipe(Ingredient inputItem, ItemStack output) implements Recipe<EntropicEvisceratorRecipeInput> {
@Override
public DefaultedList<Ingredient> getIngredients() {
DefaultedList<Ingredient> list = DefaultedList.of();
list.add(this.inputItem);
return list;
}
// Read JSON Files
// Turns into new EntropicEvisceratorRecipe
@Override
public boolean matches(EntropicEvisceratorRecipeInput input, World world) {
if(world.isClient()) {
return false;
}
return inputItem.test(input.getStackInSlot(0));
}
@Override
public ItemStack craft(EntropicEvisceratorRecipeInput input, RegistryWrapper.WrapperLookup lookup) {
return output.copy();
}
@Override
public boolean fits(int width, int height) {
return true;
}
@Override
public ItemStack getResult(RegistryWrapper.WrapperLookup registriesLookup) {
return output;
}
@Override
public RecipeSerializer<?> getSerializer() {
return ModRecipies.ENTROPIC_EVISCERATOR_SERIALIZER;
}
@Override
public RecipeType<?> getType() {
return ModRecipies.ENTROPIC_EVISCERATOR_TYPE;
}
public static class Serializer implements RecipeSerializer<EntropicEvisceratorRecipe> {
public static final MapCodec<EntropicEvisceratorRecipe> CODEC = RecordCodecBuilder.mapCodec(inst -> inst.group(
Ingredient.DISALLOW_EMPTY_CODEC.fieldOf("ingredient").forGetter(EntropicEvisceratorRecipe::inputItem),
ItemStack.CODEC.fieldOf("result").forGetter(EntropicEvisceratorRecipe::output)
).apply(inst, EntropicEvisceratorRecipe::new));
public static final PacketCodec<RegistryByteBuf, EntropicEvisceratorRecipe> STREAM_CODEC =
PacketCodec.tuple(
Ingredient.PACKET_CODEC, EntropicEvisceratorRecipe::inputItem,
ItemStack.PACKET_CODEC, EntropicEvisceratorRecipe::output,
EntropicEvisceratorRecipe::new);
@Override
public MapCodec<EntropicEvisceratorRecipe> codec() {
return CODEC;
}
@Override
public PacketCodec<RegistryByteBuf, EntropicEvisceratorRecipe> packetCodec() {
return STREAM_CODEC;
}
}
}
@@ -0,0 +1,16 @@
package com.acethewildfire.acesbs.recipe;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.input.RecipeInput;
public record EntropicEvisceratorRecipeInput(ItemStack input) implements RecipeInput {
@Override
public ItemStack getStackInSlot(int slot) {
return input;
}
@Override
public int getSize() {
return 2;
}
}
@@ -21,6 +21,19 @@ public class ModRecipies {
}
});
public static final RecipeSerializer<EntropicEvisceratorRecipe> ENTROPIC_EVISCERATOR_SERIALIZER =
Registry.register(Registries.RECIPE_SERIALIZER, Identifier.of(AcesBS.MOD_ID, "entropic_eviscerator"),
new EntropicEvisceratorRecipe.Serializer());
public static final RecipeType<EntropicEvisceratorRecipe> ENTROPIC_EVISCERATOR_TYPE =
Registry.register(Registries.RECIPE_TYPE, Identifier.of(AcesBS.MOD_ID, "entropic_eviscerator"),
new RecipeType<EntropicEvisceratorRecipe>() {
@Override
public String toString() {
return "entropic_eviscerator";
}
});
public static void registerRecipes() {
AcesBS.LOGGER.info("Registering Custom Recipes for " + AcesBS.MOD_ID);
}
@@ -1,6 +1,7 @@
package com.acethewildfire.acesbs.screen;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.screen.custom.EntropicEvisceratorScreenHandler;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreenHandler;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType;
import net.minecraft.registry.Registries;
@@ -15,6 +16,10 @@ public class ModScreenHandlers {
Registry.register(Registries.SCREEN_HANDLER, Identifier.of(AcesBS.MOD_ID, "entropic_stabilizer_screen_handler"),
new ExtendedScreenHandlerType<>(EntropicStabilizerScreenHandler::new, BlockPos.PACKET_CODEC));
public static final ScreenHandlerType<EntropicEvisceratorScreenHandler> ENTROPIC_EVISCERATOR_SCREEN_HANDLER =
Registry.register(Registries.SCREEN_HANDLER, Identifier.of(AcesBS.MOD_ID, "entropic_eviscerator_screen_handler"),
new ExtendedScreenHandlerType<>(EntropicEvisceratorScreenHandler::new, BlockPos.PACKET_CODEC));
public static void registerScreenHandlers() {
AcesBS.LOGGER.info("Registering Screen Handlers for " + AcesBS.MOD_ID);
}
@@ -0,0 +1,59 @@
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 EntropicEvisceratorScreen extends HandledScreen<EntropicEvisceratorScreenHandler> {
public static final Identifier GUI_TEXTURE =
Identifier.of(AcesBS.MOD_ID, "textures/gui/entropic_eviscerator/entropic_eviscerator_gui.png");
public static final Identifier EVISCERATE_TEXTURE =
Identifier.of(AcesBS.MOD_ID, "textures/gui/eviscerate_progress.png");
public EntropicEvisceratorScreen(EntropicEvisceratorScreenHandler 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);
// renderProgressArrow(context, x, y);
renderEviscerateProgress(context, x, y);
}
// private void renderProgressArrow(DrawContext context, int x, int y) {
//
// if(handler.isCrafting()) {
// context.drawTexture(ARROW_TEXTURE, x + 79, y + 35, 0, 0,
// handler.getScaledArrowProgress(), 16, 24, 16);
// }
// }
private void renderEviscerateProgress(DrawContext context, int x, int y) {
if(handler.isCooking()) {
context.drawTexture(EVISCERATE_TEXTURE, x + 80, y + 35, 0, 0,
16, handler.getScaledEviscerateProgress(), 16, 16);
}
}
@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,142 @@
package com.acethewildfire.acesbs.screen.custom;
import com.acethewildfire.acesbs.block.entity.custom.EntropicEvisceratorEntity;
import com.acethewildfire.acesbs.block.entity.custom.EntropicStabilizerEntity;
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.ArrayPropertyDelegate;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.math.BlockPos;
public class EntropicEvisceratorScreenHandler extends ScreenHandler {
private final Inventory inventory;
private final PropertyDelegate propertyDelegate;
public final EntropicEvisceratorEntity blockEntity;
public EntropicEvisceratorScreenHandler(int syncId, PlayerInventory playerInventory, BlockPos pos) {
this(syncId, playerInventory, playerInventory.player.getWorld().getBlockEntity(pos), new ArrayPropertyDelegate(4));
}
public EntropicEvisceratorScreenHandler(int syncId, PlayerInventory playerInventory, BlockEntity blockEntity, PropertyDelegate arrayPropertyDelegate) {
super(ModScreenHandlers.ENTROPIC_EVISCERATOR_SCREEN_HANDLER, syncId);
this.inventory = ((Inventory) blockEntity);
this.blockEntity = ((EntropicEvisceratorEntity) blockEntity);
this.propertyDelegate = arrayPropertyDelegate;
this.addSlot(new Slot(inventory, 0, 80, 17)); //Item
this.addSlot(new Slot(inventory, 1, 8, 17)); //Fuel
this.addSlot(new Slot(inventory, 2, 80, 53)); // Output
addPlayerInventory(playerInventory);
addPlayerHotbar(playerInventory);
addProperties(arrayPropertyDelegate);
}
public boolean isCrafting() {
return propertyDelegate.get(2) > 0;
}
public boolean isCooking() {
return propertyDelegate.get(0) > 0;
}
// public int getScaledArrowProgress() {
// int progress = this.propertyDelegate.get(2);
// int maxProgress = this.propertyDelegate.get(3); // Max Progress
// int arrowPixelSize = 24; // This is the width in pixels of your arrow
//
// return maxProgress != 0 && progress != 0 ? progress * arrowPixelSize / maxProgress : 0;
// }
public int getScaledEviscerateProgress() {
int progress = this.propertyDelegate.get(2);
int maxProgress = this.propertyDelegate.get(3); // Max Progress
int evisceratePixelSize = 16; // This is the width in pixels of your bar
return maxProgress != 0 && progress != 0 ? progress * evisceratePixelSize / maxProgress : 0;
}
@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.isEviscerateable(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 isEviscerateable(ItemStack itemStack) {
return itemStack.isOf(ModItems.RAW_ENTROPY) || itemStack.isOf(ModItems.RAW_ENDTROPY);
}
protected boolean isFuel(ItemStack itemStack) {
return itemStack.isOf(ModItems.STABLE_ENTROPY);
}
@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));
}
}
}
@@ -48,7 +48,7 @@ public class EntropicStabilizerScreen extends HandledScreen<EntropicStabilizerSc
private void renderStabilizeProgress(DrawContext context, int x, int y) {
if(handler.isCooking()) {
context.drawTexture(STABILIZE_TEXTURE, x + 56, y + 35, 0, 0,
16, handler.getScaledStabilizeProgress(), 16, 16);
16, handler.getScaledEviscerateProgress(), 16, 16);
}
}
@@ -56,7 +56,7 @@ public class EntropicStabilizerScreenHandler extends ScreenHandler {
return maxProgress != 0 && progress != 0 ? progress * arrowPixelSize / maxProgress : 0;
}
public int getScaledStabilizeProgress() {
public int getScaledEviscerateProgress() {
int progress = this.propertyDelegate.get(0);
int maxProgress = this.propertyDelegate.get(1); // Max Progress
int stabilizePixelSize = 16; // This is the width in pixels of your bar
@@ -117,7 +117,7 @@ public class EntropicStabilizerScreenHandler extends ScreenHandler {
}
protected boolean isFuel(ItemStack itemStack) {
return itemStack.isOf(Items.SNOWBALL);
return itemStack.isOf(Items.BLUE_ICE);
}
@Override
@@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "acesbs:block/entropic_evicerator"
}
}
}
@@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "acesbs:block/entropic_eviscerator" },
"facing=south": { "model": "acesbs:block/entropic_eviscerator", "y": 180 },
"facing=west": { "model": "acesbs:block/entropic_eviscerator", "y": 270 },
"facing=east": { "model": "acesbs:block/entropic_eviscerator", "y": 90 }
}
}
@@ -100,7 +100,7 @@
"block.acesbs.endtropy_ore": "Endtropic Ore",
"block.acesbs.stable_entropy_block": "Block of Stabilized Entropy",
"block.acesbs.entropic_stabilizer": "Entropic Stabilizer",
"block.acesbs.entropic_evicerator": "Entropic Evicerator",
"block.acesbs.entropic_eviscerator": "Entropic Eviscerator",
"block.acesbs.entropic_entangler": "Entropic Entangler",
"block.acesbs.lizard_planks": "Lizard Planks",
@@ -3,8 +3,8 @@
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"0": "acesbs:block/entropic_evicerator",
"particle": "acesbs:block/entropic_evicerator"
"0": "acesbs:block/entropic_eviscerator",
"particle": "acesbs:block/entropic_eviscerator"
},
"elements": [
{
@@ -1,3 +0,0 @@
{
"parent": "acesbs:block/entropic_evicerator"
}
@@ -0,0 +1,3 @@
{
"parent": "acesbs:block/entropic_eviscerator"
}

Before

Width:  |  Height:  |  Size: 846 B

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

@@ -0,0 +1,10 @@
{
"type": "acesbs:entropic_eviscerator",
"ingredient": {
"item": "minecraft:wheat_seeds"
},
"result": {
"count": 1,
"id": "acesbs:tobacco_seeds"
}
}