Remove Utamacraft Item #52

Merged
BlakeRain merged 2 commits from BlakeRain/utamacraft:43-remove-utamacraft-item into main 2023-12-29 23:56:09 +00:00
21 changed files with 89 additions and 81 deletions
Showing only changes of commit 4d3f8880a7 - Show all commits

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft; package net.banutama.utamacraft;
import com.mojang.logging.LogUtils;
import dan200.computercraft.api.ForgeComputerCraftAPI; import dan200.computercraft.api.ForgeComputerCraftAPI;
import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser; import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser;
import net.banutama.utamacraft.block.entity.InsolatorBlockEntity; import net.banutama.utamacraft.block.entity.InsolatorBlockEntity;
@ -11,18 +10,18 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
import org.slf4j.Logger;
/** /**
* CC:Tweaked registration * CC:Tweaked registration
*/ */
public class CCRegistration { public class CCRegistration {
public static final DeferredRegister<TurtleUpgradeSerialiser<?>> TURTLE_SERIALIZERS = public static final DeferredRegister<TurtleUpgradeSerialiser<?>> TURTLE_SERIALIZERS = DeferredRegister
DeferredRegister.create(TurtleUpgradeSerialiser.REGISTRY_ID, Utamacraft.MOD_ID); .create(TurtleUpgradeSerialiser.REGISTRY_ID, Utamacraft.MOD_ID);
public static final RegistryObject<TurtleUpgradeSerialiser<TurtlePlayerUpgrade>> PLAYER_TURTLE = public static final RegistryObject<TurtleUpgradeSerialiser<TurtlePlayerUpgrade>> PLAYER_TURTLE = TURTLE_SERIALIZERS
TURTLE_SERIALIZERS.register(ID.PLAYER_TURTLE.getPath(), () -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtlePlayerUpgrade::new)); .register(ID.PLAYER_TURTLE.getPath(),
() -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtlePlayerUpgrade::new));
public static PeripheralProvider peripheralProvider = new PeripheralProvider(); public static PeripheralProvider peripheralProvider = new PeripheralProvider();

View File

@ -1,14 +1,11 @@
package net.banutama.utamacraft; package net.banutama.utamacraft;
import com.google.common.eventbus.Subscribe;
import com.mojang.logging.LogUtils; import com.mojang.logging.LogUtils;
import net.banutama.utamacraft.block.custom.ModBlocks; import net.banutama.utamacraft.block.custom.ModBlocks;
import net.banutama.utamacraft.block.entity.ModBlockEntities; import net.banutama.utamacraft.block.entity.ModBlockEntities;
import net.banutama.utamacraft.client.model.AmuletModel;
import net.banutama.utamacraft.integrations.curios.CuriosRenderers; import net.banutama.utamacraft.integrations.curios.CuriosRenderers;
import net.banutama.utamacraft.integrations.curios.CuriousLayerDefinitions; import net.banutama.utamacraft.integrations.curios.CuriousLayerDefinitions;
import net.banutama.utamacraft.item.FireWardItem;
import net.banutama.utamacraft.item.ModItems; import net.banutama.utamacraft.item.ModItems;
import net.banutama.utamacraft.networking.ModMessages; import net.banutama.utamacraft.networking.ModMessages;
@ -36,7 +33,6 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger; import org.slf4j.Logger;
import top.theillusivec4.curios.api.SlotTypeMessage; import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.SlotTypePreset; import top.theillusivec4.curios.api.SlotTypePreset;
import top.theillusivec4.curios.api.client.CuriosRendererRegistry;
// The value here should match an entry in the META-INF/mods.toml file // The value here should match an entry in the META-INF/mods.toml file
@Mod(Utamacraft.MOD_ID) @Mod(Utamacraft.MOD_ID)

View File

@ -44,12 +44,13 @@ public class InsolatorBlock extends BaseEntityBlock {
} }
private static Block.Properties getProperties() { private static Block.Properties getProperties() {
return Block.Properties.of(Material.METAL).strength(6.0f).requiresCorrectToolForDrops().noOcclusion().lightLevel(state -> state.getValue(ACTIVE) ? 15 : 0); return Block.Properties.of(Material.METAL).strength(6.0f).requiresCorrectToolForDrops().noOcclusion()
.lightLevel(state -> state.getValue(ACTIVE) ? 15 : 0);
} }
@SuppressWarnings("deprecation")
@Override @Override
public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter getter, @NotNull BlockPos pos, @NotNull CollisionContext context) { public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter getter, @NotNull BlockPos pos,
@NotNull CollisionContext context) {
return SHAPE; return SHAPE;
} }
@ -59,7 +60,6 @@ public class InsolatorBlock extends BaseEntityBlock {
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
} }
@SuppressWarnings("deprecation")
@Override @Override
public @NotNull BlockState rotate(BlockState state, Rotation rotation) { public @NotNull BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
@ -76,7 +76,6 @@ public class InsolatorBlock extends BaseEntityBlock {
builder.add(FACING, ACTIVE); builder.add(FACING, ACTIVE);
} }
@SuppressWarnings("deprecation")
@Override @Override
public @NotNull RenderShape getRenderShape(@NotNull BlockState pState) { public @NotNull RenderShape getRenderShape(@NotNull BlockState pState) {
return RenderShape.MODEL; return RenderShape.MODEL;
@ -84,7 +83,8 @@ public class InsolatorBlock extends BaseEntityBlock {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void onRemove(BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, BlockState pNewState, boolean pIsMoving) { public void onRemove(BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, BlockState pNewState,
boolean pIsMoving) {
if (!pState.is(pNewState.getBlock())) { if (!pState.is(pNewState.getBlock())) {
BlockEntity blockEntity = pLevel.getBlockEntity(pPos); BlockEntity blockEntity = pLevel.getBlockEntity(pPos);
if (blockEntity instanceof InsolatorBlockEntity insolator) { if (blockEntity instanceof InsolatorBlockEntity insolator) {
@ -103,9 +103,9 @@ public class InsolatorBlock extends BaseEntityBlock {
super.onRemove(pState, pLevel, pPos, pNewState, pIsMoving); super.onRemove(pState, pLevel, pPos, pNewState, pIsMoving);
} }
@SuppressWarnings("deprecation")
@Override @Override
public @NotNull InteractionResult use(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, @NotNull Player pPlayer, @NotNull InteractionHand pHand, @NotNull BlockHitResult pHit) { public @NotNull InteractionResult use(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos,
@NotNull Player pPlayer, @NotNull InteractionHand pHand, @NotNull BlockHitResult pHit) {
BlockEntity blockEntity = pLevel.getBlockEntity(pPos); BlockEntity blockEntity = pLevel.getBlockEntity(pPos);
if (!(blockEntity instanceof InsolatorBlockEntity insolatorEntity)) { if (!(blockEntity instanceof InsolatorBlockEntity insolatorEntity)) {
return InteractionResult.PASS; return InteractionResult.PASS;
@ -130,7 +130,8 @@ public class InsolatorBlock extends BaseEntityBlock {
@Nullable @Nullable
@Override @Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level pLevel, @NotNull BlockState pState, @NotNull BlockEntityType<T> pBlockEntityType) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level pLevel, @NotNull BlockState pState,
@NotNull BlockEntityType<T> pBlockEntityType) {
if (pLevel.isClientSide()) { if (pLevel.isClientSide()) {
return null; return null;
} }
@ -139,10 +140,12 @@ public class InsolatorBlock extends BaseEntityBlock {
} }
@Override @Override
public void animateTick(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, @NotNull RandomSource pRandom) { public void animateTick(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos,
@NotNull RandomSource pRandom) {
if (pState.getValue(ACTIVE)) { if (pState.getValue(ACTIVE)) {
if (pRandom.nextDouble() < 1.0d) { if (pRandom.nextDouble() < 1.0d) {
pLevel.playLocalSound(pPos.getX() + 0.5, pPos.getY() + 0.5, pPos.getZ() + 0.5, ModSounds.INSOLATOR.get(), SoundSource.BLOCKS, 0.1f, 1.0f, false); pLevel.playLocalSound(pPos.getX() + 0.5, pPos.getY() + 0.5, pPos.getZ() + 0.5,
ModSounds.INSOLATOR.get(), SoundSource.BLOCKS, 0.1f, 1.0f, false);
} }
} }
} }

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft.block.entity; package net.banutama.utamacraft.block.entity;
import com.mojang.logging.LogUtils;
import net.banutama.utamacraft.block.custom.InsolatorBlock; import net.banutama.utamacraft.block.custom.InsolatorBlock;
import net.banutama.utamacraft.recipe.InsolatorRecipe; import net.banutama.utamacraft.recipe.InsolatorRecipe;
import net.banutama.utamacraft.recipe.ModRecipes; import net.banutama.utamacraft.recipe.ModRecipes;
@ -98,7 +97,8 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
@Nullable @Nullable
@Override @Override
public AbstractContainerMenu createMenu(int pContainerId, @NotNull Inventory pPlayerInventory, @NotNull Player pPlayer) { public AbstractContainerMenu createMenu(int pContainerId, @NotNull Inventory pPlayerInventory,
@NotNull Player pPlayer) {
return new InsolatorMenu(pContainerId, pPlayerInventory, this); return new InsolatorMenu(pContainerId, pPlayerInventory, this);
} }
@ -215,9 +215,10 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
if (entity.fluid.isFluidValid(stack)) { if (entity.fluid.isFluidValid(stack)) {
// Remove the amount of fluid from the IFluidHandlerItem // Remove the amount of fluid from the IFluidHandlerItem
stack = handler.drain(amount, IFluidHandler.FluidAction.EXECUTE); stack = handler.drain(amount, IFluidHandler.FluidAction.EXECUTE);
// Fill our fluid tank with the fluid stack we drained from the IFluidHandlerItem // Fill our fluid tank with the fluid stack we drained from the
// IFluidHandlerItem
entity.fluid.fill(stack, IFluidHandler.FluidAction.EXECUTE); entity.fluid.fill(stack, IFluidHandler.FluidAction.EXECUTE);
// Extract the current item from the fluid slot? TODO: Should this be when empty? // Extract the current item from the fluid slot?
entity.inventory.extractItem(0, 1, false); entity.inventory.extractItem(0, 1, false);
entity.inventory.insertItem(0, handler.getContainer(), false); entity.inventory.insertItem(0, handler.getContainer(), false);
} }
@ -265,7 +266,8 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
ItemStack output = inventory.getStackInSlot(2); ItemStack output = inventory.getStackInSlot(2);
// If the output isn't empty, and the item in the output is different to the output of the recipe, we cannot process. // If the output isn't empty, and the item in the output is different to the
// output of the recipe, we cannot process.
if (!output.isEmpty() && output.getItem() != recipe.getResultItem().getItem()) { if (!output.isEmpty() && output.getItem() != recipe.getResultItem().getItem()) {
return false; return false;
} }

View File

@ -9,12 +9,12 @@ import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
public class ModBlockEntities { public class ModBlockEntities {
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister
DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, Utamacraft.MOD_ID); .create(ForgeRegistries.BLOCK_ENTITY_TYPES, Utamacraft.MOD_ID);
public static final RegistryObject<BlockEntityType<InsolatorBlockEntity>> INSOLATOR = public static final RegistryObject<BlockEntityType<InsolatorBlockEntity>> INSOLATOR = BLOCK_ENTITIES.register(
BLOCK_ENTITIES.register("insolator", () -> "insolator",
BlockEntityType.Builder.of(InsolatorBlockEntity::new, ModBlocks.INSOLATOR.get()).build(null)); () -> BlockEntityType.Builder.of(InsolatorBlockEntity::new, ModBlocks.INSOLATOR.get()).build(null));
public static void register(IEventBus bus) { public static void register(IEventBus bus) {
BLOCK_ENTITIES.register(bus); BLOCK_ENTITIES.register(bus);

View File

@ -13,6 +13,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
public class ClientRegistry { public class ClientRegistry {
@SubscribeEvent @SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) { public static void onClientSetup(FMLClientSetupEvent event) {
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.PLAYER_TURTLE.get(), TurtleUpgradeModeller.flatItem()); ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.PLAYER_TURTLE.get(),
TurtleUpgradeModeller.flatItem());
} }
} }

View File

@ -33,7 +33,8 @@ public class AmuletModel extends HumanoidModel<LivingEntity> {
} }
@Override @Override
public void renderToBuffer(PoseStack pPoseStack, @NotNull VertexConsumer pBuffer, int pPackedLight, int pPackedOverlay, float pRed, float pGreen, float pBlue, float pAlpha) { public void renderToBuffer(PoseStack pPoseStack, @NotNull VertexConsumer pBuffer, int pPackedLight,
int pPackedOverlay, float pRed, float pGreen, float pBlue, float pAlpha) {
pPoseStack.pushPose(); pPoseStack.pushPose();
pPoseStack.scale(0.25f, 0.25f, 0.25f); pPoseStack.scale(0.25f, 0.25f, 0.25f);
super.renderToBuffer(pPoseStack, pBuffer, pPackedLight, pPackedOverlay, pRed, pGreen, pBlue, pAlpha); super.renderToBuffer(pPoseStack, pBuffer, pPackedLight, pPackedOverlay, pRed, pGreen, pBlue, pAlpha);
@ -51,4 +52,4 @@ public class AmuletModel extends HumanoidModel<LivingEntity> {
return mesh; return mesh;
} }
} }

View File

@ -25,7 +25,8 @@ public class BoundMethod {
} }
@NotNull @NotNull
public MethodResult apply(@NotNull IComputerAccess computer, @NotNull ILuaContext context, @NotNull IArguments arguments) throws LuaException { public MethodResult apply(@NotNull IComputerAccess computer, @NotNull ILuaContext context,
@NotNull IArguments arguments) throws LuaException {
return method.apply(target, context, computer, arguments); return method.apply(target, context, computer, arguments);
} }

View File

@ -18,13 +18,15 @@ import java.util.function.Predicate;
public class PeripheralProvider implements IPeripheralProvider { public class PeripheralProvider implements IPeripheralProvider {
private final List<BlockEntityPeripheral> blockEntityPeripherals = new ArrayList<>(); private final List<BlockEntityPeripheral> blockEntityPeripherals = new ArrayList<>();
public void registerBlockPeripheral(Function<BlockEntity, ? extends IPeripheral> build, Predicate<BlockEntity> predicate) { public void registerBlockPeripheral(Function<BlockEntity, ? extends IPeripheral> build,
Predicate<BlockEntity> predicate) {
blockEntityPeripherals.add(new BlockEntityPeripheral(build, predicate)); blockEntityPeripherals.add(new BlockEntityPeripheral(build, predicate));
} }
@NotNull @NotNull
@Override @Override
public LazyOptional<IPeripheral> getPeripheral(@NotNull Level world, @NotNull BlockPos pos, @NotNull Direction side) { public LazyOptional<IPeripheral> getPeripheral(@NotNull Level world, @NotNull BlockPos pos,
@NotNull Direction side) {
for (BlockEntityPeripheral peripheral : blockEntityPeripherals) { for (BlockEntityPeripheral peripheral : blockEntityPeripherals) {
if (peripheral.hasPeripheral(world, pos, side)) { if (peripheral.hasPeripheral(world, pos, side)) {
return LazyOptional.of(() -> peripheral.buildPeripheral(world, pos, side)); return LazyOptional.of(() -> peripheral.buildPeripheral(world, pos, side));

View File

@ -19,7 +19,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public abstract class BasePeripheral implements IPeripheral, IDynamicPeripheral { public abstract class BasePeripheral implements IDynamicPeripheral {
protected final String type; protected final String type;
protected final BasePeripheralOwner owner; protected final BasePeripheralOwner owner;
protected final List<BoundMethod> methods; protected final List<BoundMethod> methods;
@ -28,7 +28,8 @@ public abstract class BasePeripheral implements IPeripheral, IDynamicPeripheral
protected BasePeripheral(String type, BasePeripheralOwner owner) { protected BasePeripheral(String type, BasePeripheralOwner owner) {
this.type = type; this.type = type;
this.owner = owner; this.owner = owner;
this.methods = PeripheralMethod.GENERATOR.getMethods(this.getClass()).stream().map(named -> new BoundMethod(this, named)).collect(Collectors.toList()); this.methods = PeripheralMethod.GENERATOR.getMethods(this.getClass()).stream()
.map(named -> new BoundMethod(this, named)).collect(Collectors.toList());
} }
@NotNull @NotNull
@ -39,7 +40,8 @@ public abstract class BasePeripheral implements IPeripheral, IDynamicPeripheral
@NotNull @NotNull
@Override @Override
public MethodResult callMethod(@NotNull IComputerAccess computer, @NotNull ILuaContext context, int method, @NotNull IArguments arguments) throws LuaException { public MethodResult callMethod(@NotNull IComputerAccess computer, @NotNull ILuaContext context, int method,
@NotNull IArguments arguments) throws LuaException {
return methods.get(method).apply(computer, context, arguments); return methods.get(method).apply(computer, context, arguments);
} }

View File

@ -28,7 +28,8 @@ public class BlockEntityPeripheral {
return predicate.test(entity); return predicate.test(entity);
} }
public @NotNull IPeripheral buildPeripheral(@NotNull Level level, @NotNull BlockPos pos, @NotNull Direction direction) { public @NotNull IPeripheral buildPeripheral(@NotNull Level level, @NotNull BlockPos pos,
@NotNull Direction direction) {
BlockEntity entity = level.getBlockEntity(pos); BlockEntity entity = level.getBlockEntity(pos);
if (entity == null) { if (entity == null) {
throw new IllegalArgumentException("No BlockEntity at this location"); throw new IllegalArgumentException("No BlockEntity at this location");
@ -36,4 +37,4 @@ public class BlockEntityPeripheral {
return build.apply(entity); return build.apply(entity);
} }
} }

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft.integrations.computercraft.peripheral; package net.banutama.utamacraft.integrations.computercraft.peripheral;
import com.mojang.logging.LogUtils;
import dan200.computercraft.api.lua.LuaFunction; import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.api.lua.MethodResult; import dan200.computercraft.api.lua.MethodResult;
import net.banutama.utamacraft.block.entity.InsolatorBlockEntity; import net.banutama.utamacraft.block.entity.InsolatorBlockEntity;
@ -8,15 +7,12 @@ import net.banutama.utamacraft.integrations.computercraft.utils.WrapResult;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class InsolatorPeripheral extends BasePeripheral { public class InsolatorPeripheral extends BasePeripheral {
public static final String PERIPHERAL_TYPE = "insolator"; public static final String PERIPHERAL_TYPE = "insolator";
private static final Logger LOGGER = LogUtils.getLogger();
protected InsolatorPeripheral(BasePeripheralOwner owner) { protected InsolatorPeripheral(BasePeripheralOwner owner) {
super(PERIPHERAL_TYPE, owner); super(PERIPHERAL_TYPE, owner);
@ -34,7 +30,8 @@ public class InsolatorPeripheral extends BasePeripheral {
BlockEntity blockEntity = blockOwner.getBlockEntity(); BlockEntity blockEntity = blockOwner.getBlockEntity();
if (!(blockEntity instanceof InsolatorBlockEntity insolator)) { if (!(blockEntity instanceof InsolatorBlockEntity insolator)) {
return MethodResult.of(null, "Owner of this InsolatorPeripheral has a BlockEntityProviderOwner with a BlockEntity that is not an InsolatorBlockEntity"); return MethodResult.of(null,
"Owner of this InsolatorPeripheral has a BlockEntityProviderOwner with a BlockEntity that is not an InsolatorBlockEntity");
} }
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();

View File

@ -15,4 +15,8 @@ public class TurtlePeripheralOwner extends BasePeripheralOwner {
public ITurtleAccess getTurtle() { public ITurtleAccess getTurtle() {
return turtle; return turtle;
} }
public TurtleSide getTurtleSide() {
return side;
}
} }

View File

@ -18,7 +18,7 @@ public class TurtlePlayerCache {
private static SimpleFakePlayer getPlayerFor(ITurtleAccess turtle, GameProfile profile) { private static SimpleFakePlayer getPlayerFor(ITurtleAccess turtle, GameProfile profile) {
SimpleFakePlayer player = PLAYERS.get(turtle); SimpleFakePlayer player = PLAYERS.get(turtle);
if (player == null) { if (player == null) {
player = new SimpleFakePlayer((ServerLevel)turtle.getLevel(), profile); player = new SimpleFakePlayer((ServerLevel) turtle.getLevel(), profile);
PLAYERS.put(turtle, player); PLAYERS.put(turtle, player);
} }
@ -36,15 +36,18 @@ public class TurtlePlayerCache {
Direction direction = turtle.getDirection(); Direction direction = turtle.getDirection();
float pitch = direction == Direction.UP ? -90.0f : direction == Direction.DOWN ? 90.0f : 0.0f; float pitch = direction == Direction.UP ? -90.0f : direction == Direction.DOWN ? 90.0f : 0.0f;
float yaw = direction == Direction.SOUTH ? 0.0f : direction == Direction.WEST ? 90.0f : direction == Direction.NORTH ? 180.0f : -90.0f; float yaw = direction == Direction.SOUTH ? 0.0f
: direction == Direction.WEST ? 90.0f : direction == Direction.NORTH ? 180.0f : -90.0f;
Vec3i normal = direction.getNormal(); Vec3i normal = direction.getNormal();
Direction.Axis axis = direction.getAxis(); Direction.Axis axis = direction.getAxis();
Direction.AxisDirection axis_dir = direction.getAxisDirection(); Direction.AxisDirection axis_dir = direction.getAxisDirection();
double x = (axis == Direction.Axis.X && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5 : (0.5 + normal.getX() / 1.9); double x = (axis == Direction.Axis.X && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5
: (0.5 + normal.getX() / 1.9);
double y = 0.5 + normal.getY() / 1.9; double y = 0.5 + normal.getY() / 1.9;
double z = (axis == Direction.Axis.Z && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5 : (0.5 + normal.getZ() / 1.9); double z = (axis == Direction.Axis.Z && axis_dir == Direction.AxisDirection.NEGATIVE) ? -0.5
: (0.5 + normal.getZ() / 1.9);
player.moveTo(position.getX() + x, position.getY() + y, position.getZ() + z, yaw, pitch); player.moveTo(position.getX() + x, position.getY() + y, position.getZ() + z, yaw, pitch);
return callback.apply(player); return callback.apply(player);

View File

@ -1,24 +1,19 @@
package net.banutama.utamacraft.integrations.computercraft.turtles; package net.banutama.utamacraft.integrations.computercraft.turtles;
import com.mojang.logging.LogUtils;
import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.api.turtle.TurtleSide;
import net.banutama.utamacraft.integrations.computercraft.peripheral.PlayerPeripheral; import net.banutama.utamacraft.integrations.computercraft.peripheral.PlayerPeripheral;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
public class TurtlePlayerUpgrade extends PeripheralTurtleUpgrade<PlayerPeripheral> { public class TurtlePlayerUpgrade extends PeripheralTurtleUpgrade<PlayerPeripheral> {
private static final Logger LOGGER = LogUtils.getLogger();
public TurtlePlayerUpgrade(ResourceLocation id, ItemStack item) { public TurtlePlayerUpgrade(ResourceLocation id, ItemStack item) {
super(id, item); super(id, item);
} }
@Override @Override
protected PlayerPeripheral buildPeripheral(@NotNull ITurtleAccess turtle, @NotNull TurtleSide side) { protected PlayerPeripheral buildPeripheral(@NotNull ITurtleAccess turtle, @NotNull TurtleSide side) {
LOGGER.info("Building PlayerPeripheral for TurtlePlayerUpgrade");
return new PlayerPeripheral(turtle, side); return new PlayerPeripheral(turtle, side);
} }
} }

View File

@ -1,7 +1,5 @@
package net.banutama.utamacraft.integrations.computercraft.utils; package net.banutama.utamacraft.integrations.computercraft.utils;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;

View File

@ -21,7 +21,8 @@ public class CuriosRenderer implements ICurioRenderer {
private final HumanoidModel<LivingEntity> model; private final HumanoidModel<LivingEntity> model;
public CuriosRenderer(String texturePath, HumanoidModel<LivingEntity> model) { public CuriosRenderer(String texturePath, HumanoidModel<LivingEntity> model) {
this(new ResourceLocation(Utamacraft.MOD_ID, String.format("textures/entity/curio/%s_curio.png", texturePath)), model); this(new ResourceLocation(Utamacraft.MOD_ID, String.format("textures/entity/curio/%s_curio.png", texturePath)),
model);
} }
public CuriosRenderer(ResourceLocation texture, HumanoidModel<LivingEntity> model) { public CuriosRenderer(ResourceLocation texture, HumanoidModel<LivingEntity> model) {
@ -31,23 +32,24 @@ public class CuriosRenderer implements ICurioRenderer {
@Override @Override
public <T extends LivingEntity, M extends EntityModel<T>> void render(ItemStack stack, public <T extends LivingEntity, M extends EntityModel<T>> void render(ItemStack stack,
SlotContext slotContext, SlotContext slotContext,
PoseStack matrixStack, PoseStack matrixStack,
RenderLayerParent<T, M> renderLayerParent, RenderLayerParent<T, M> renderLayerParent,
MultiBufferSource renderTypeBuffer, MultiBufferSource renderTypeBuffer,
int light, int light,
float limbSwing, float limbSwing,
float limbSwingAmount, float limbSwingAmount,
float partialTicks, float partialTicks,
float ageInTicks, float ageInTicks,
float netHeadYaw, float netHeadYaw,
float headPitch) { float headPitch) {
model.setupAnim(slotContext.entity(), limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); model.setupAnim(slotContext.entity(), limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
model.prepareMobModel(slotContext.entity(), limbSwing, limbSwingAmount, partialTicks); model.prepareMobModel(slotContext.entity(), limbSwing, limbSwingAmount, partialTicks);
ICurioRenderer.followBodyRotations(slotContext.entity(), model); ICurioRenderer.followBodyRotations(slotContext.entity(), model);
RenderType renderType = model.renderType(texture); RenderType renderType = model.renderType(texture);
VertexConsumer vertexConsumer = ItemRenderer.getFoilBuffer(renderTypeBuffer, renderType, false, stack.hasFoil()); VertexConsumer vertexConsumer = ItemRenderer.getFoilBuffer(renderTypeBuffer, renderType, false,
stack.hasFoil());
model.renderToBuffer(matrixStack, vertexConsumer, light, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f); model.renderToBuffer(matrixStack, vertexConsumer, light, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
} }
} }

View File

@ -8,8 +8,8 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.EntityRenderersEvent;
public class CuriousLayerDefinitions { public class CuriousLayerDefinitions {
public static final ModelLayerLocation FIRE_WARD = public static final ModelLayerLocation FIRE_WARD = new ModelLayerLocation(
new ModelLayerLocation(new ResourceLocation(Utamacraft.MOD_ID, "fire_ward"), "fire_ward"); new ResourceLocation(Utamacraft.MOD_ID, "fire_ward"), "fire_ward");
public static void register(EntityRenderersEvent.RegisterLayerDefinitions event) { public static void register(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(FIRE_WARD, () -> { event.registerLayerDefinition(FIRE_WARD, () -> {

View File

@ -15,24 +15,24 @@ import net.banutama.utamacraft.recipe.InsolatorRecipe;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import org.checkerframework.checker.units.qual.A;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
public class InsolatorRecipeCategory implements IRecipeCategory<InsolatorRecipe> { public class InsolatorRecipeCategory implements IRecipeCategory<InsolatorRecipe> {
public final static ResourceLocation UID = new ResourceLocation(Utamacraft.MOD_ID, "insolator"); public final static ResourceLocation UID = new ResourceLocation(Utamacraft.MOD_ID, "insolator");
public final static ResourceLocation TEXTURE = public final static ResourceLocation TEXTURE = new ResourceLocation(Utamacraft.MOD_ID,
new ResourceLocation(Utamacraft.MOD_ID, "textures/gui/insolator_gui.png"); "textures/gui/insolator_gui.png");
public static final RecipeType<InsolatorRecipe> INSOLATOR_TYPE = public static final RecipeType<InsolatorRecipe> INSOLATOR_TYPE = new RecipeType<>(InsolatorRecipeCategory.UID,
new RecipeType<>(InsolatorRecipeCategory.UID, InsolatorRecipe.class); InsolatorRecipe.class);
private final IDrawable background; private final IDrawable background;
private final IDrawable icon; private final IDrawable icon;
public InsolatorRecipeCategory(IGuiHelper guiHelper) { public InsolatorRecipeCategory(IGuiHelper guiHelper) {
this.background = guiHelper.createDrawable(TEXTURE, 0, 0, 176, 85); this.background = guiHelper.createDrawable(TEXTURE, 0, 0, 176, 85);
this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(ModBlocks.INSOLATOR.get())); this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK,
new ItemStack(ModBlocks.INSOLATOR.get()));
} }
@Override @Override
@ -56,7 +56,8 @@ public class InsolatorRecipeCategory implements IRecipeCategory<InsolatorRecipe>
} }
@Override @Override
public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull InsolatorRecipe recipe, @NotNull IFocusGroup focuses) { public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull InsolatorRecipe recipe,
@NotNull IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.INPUT, 86, 15) builder.addSlot(RecipeIngredientRole.INPUT, 86, 15)
.addIngredients(recipe.getIngredients().get(0)); .addIngredients(recipe.getIngredients().get(0));
builder.addSlot(RecipeIngredientRole.INPUT, 33, 16) builder.addSlot(RecipeIngredientRole.INPUT, 33, 16)

View File

@ -29,6 +29,7 @@ public class ModJeiPlugin implements IModPlugin {
@Override @Override
public void registerRecipes(IRecipeRegistration registration) { public void registerRecipes(IRecipeRegistration registration) {
@SuppressWarnings("resource")
RecipeManager manager = Objects.requireNonNull(Minecraft.getInstance().level).getRecipeManager(); RecipeManager manager = Objects.requireNonNull(Minecraft.getInstance().level).getRecipeManager();
List<InsolatorRecipe> recipes = manager.getAllRecipesFor(ModRecipes.INSOLATOR_RECIPE_TYPE.get()); List<InsolatorRecipe> recipes = manager.getAllRecipesFor(ModRecipes.INSOLATOR_RECIPE_TYPE.get());
registration.addRecipes(InsolatorRecipeCategory.INSOLATOR_TYPE, recipes); registration.addRecipes(InsolatorRecipeCategory.INSOLATOR_TYPE, recipes);

View File

@ -1,6 +1,5 @@
package net.banutama.utamacraft.mixin; package net.banutama.utamacraft.mixin;
import com.mojang.logging.LogUtils;
import net.banutama.utamacraft.item.ModItems; import net.banutama.utamacraft.item.ModItems;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;