-
Posts
16 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
DERPZ774's Achievements

Tree Puncher (2/8)
0
Reputation
-
DERPZ774 changed their profile photo
-
It seems to be because of this class package com.derpz.nukaisles.recipe; import com.derpz.nukaisles.FalloutMod; import com.google.gson.JsonObject; import net.minecraft.core.RegistryAccess; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; import net.minecraft.world.SimpleContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class NukaColaMachineRecipe implements Recipe<SimpleContainer> { private final ResourceLocation id; private final ItemStack output; private final Ingredient input; private int slot; public NukaColaMachineRecipe(ResourceLocation id, ItemStack output, Ingredient input) { this.id = id; this.output = output; this.input = input; } public int getSlot() { return slot; } @Override public boolean matches(@NotNull SimpleContainer pContainer, Level pLevel) { if (pLevel.isClientSide()) { return false; } for (int i = 1; i <= 6; ++i) { if (input.test(pContainer.getItem(i))) { slot = i; return true; } } return false; } public Ingredient getIngredient() { return input; } @Override public @NotNull ItemStack assemble(@NotNull SimpleContainer pContainer, @NotNull RegistryAccess p_267165_) { return output; } @Override public boolean canCraftInDimensions(int pWidth, int pHeight) { return true; } @Override public @NotNull ItemStack getResultItem(@NotNull RegistryAccess p_267052_) { return output.copy(); } @Override public @NotNull ResourceLocation getId() { return id; } @Override public @NotNull RecipeSerializer<?> getSerializer() { return Serializer.INSTANCE; } @Override public @NotNull RecipeType<?> getType() { return Type.INSTANCE; } public static class Type implements RecipeType<NukaColaMachineRecipe> { private Type() {} public static final Type INSTANCE = new Type(); public static final String ID = "cola_cooling"; } public static class Serializer implements RecipeSerializer<NukaColaMachineRecipe> { public static final Serializer INSTANCE = new Serializer(); public static final ResourceLocation ID = new ResourceLocation(FalloutMod.MOD_ID, "cola_cooling"); @Override public @NotNull NukaColaMachineRecipe fromJson(@NotNull ResourceLocation pRecipeId, @NotNull JsonObject pSerializedRecipe) { ItemStack output = ShapedRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(pSerializedRecipe, "output")); Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pSerializedRecipe, "ingredient")); return new NukaColaMachineRecipe(pRecipeId, output, ingredient); } @Override public @Nullable NukaColaMachineRecipe fromNetwork(@NotNull ResourceLocation id, FriendlyByteBuf buf) { ItemStack output = buf.readItem(); Ingredient ingredient = Ingredient.fromNetwork(buf); return new NukaColaMachineRecipe(id, output, ingredient); } @Override public void toNetwork(FriendlyByteBuf buf, NukaColaMachineRecipe recipe) { buf.writeItemStack(recipe.getResultItem(buf.readRegistryId()), false); recipe.input.toNetwork(buf); } } }
-
So when i try to join a server with my mod installed on it i get this error and i have no idea how to fix it Im presuming its a packet issue but ill link my github repo just in case (ignore the name of the version I gotta update it) https://github.com/DERPZ774/fallout-1.19.2 ClientLog: ServerLog:
-
So I'm using the render method from BlockEntityRenderer (the class extends GeoBlockRenderer as the block is a geo model but the render method in BlockEntityRenderer works the same as the actuallyRender method used here) but I cant get more than one of the items in my block entity to load at once, the rendering itself works fine just need a pointer in how to get more than one to render at once. So if there's an item in slot one and an item in slot two for example they both render at the same time. BlockEntityRenderer: Methods called to from my actual BlockEntity class: I apologize in advance if the solution to this is really obvious haven't been modding very long
-
So make it work like the MC door?
-
I'm having a weird lighting bug on my block where it appears dark Block file: package com.derpz.nukaisles.block.custom; import javax.annotation.Nullable; import com.derpz.nukaisles.item.ModItems; import com.derpz.nukaisles.item.custom.NukaColaItem; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.NotNull; import com.derpz.nukaisles.block.entity.ModBlockEntities; import com.derpz.nukaisles.block.entity.NukaColaMachineBlockEntity; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.network.NetworkHooks; public class NukaColaMachineBlock extends BaseEntityBlock { public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; public NukaColaMachineBlock(Properties properties) { super(properties); } private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 32, 16); @Override public @NotNull VoxelShape getShape(@NotNull BlockState pState, @NotNull BlockGetter pBlock, @NotNull BlockPos pPos, @NotNull CollisionContext pContext) { return SHAPE; } //getStateForPlacement @Override public BlockState getStateForPlacement(BlockPlaceContext context) { return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); } //rotate @Override public @NotNull BlockState rotate(BlockState state, Rotation rotation) { return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } //mirror @Override public @NotNull BlockState mirror(BlockState state, Mirror mirror) { return state.rotate(mirror.getRotation(state.getValue(FACING))); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { builder.add(FACING); } @Override public @NotNull RenderShape getRenderShape(@NotNull BlockState pState) { return RenderShape.MODEL; } @Override public void onRemove(BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, BlockState pNewState, boolean pIsMoving) { if (pState.getBlock() != pNewState.getBlock()) { BlockEntity blockEntity = pLevel.getBlockEntity(pPos); if (blockEntity instanceof NukaColaMachineBlockEntity) { ((NukaColaMachineBlockEntity) blockEntity).drops(); } super.onRemove(pState, pLevel, pPos, pNewState, pIsMoving); } } @Override public @NotNull InteractionResult use(@NotNull BlockState pState, Level pLevel, @NotNull BlockPos pPos, @NotNull Player pPlayer, @NotNull InteractionHand pHand, @NotNull BlockHitResult pHit) { if (!pLevel.isClientSide) { BlockEntity blockEntity = pLevel.getBlockEntity(pPos); if (blockEntity instanceof NukaColaMachineBlockEntity NukaColaMachineBlockEntity) { ServerPlayer serverPlayer = (ServerPlayer) pPlayer; NetworkHooks.openScreen(serverPlayer, NukaColaMachineBlockEntity, pPos); } if (pPlayer.isCrouching() && pPlayer.getMainHandItem().getItem() instanceof NukaColaItem) { System.out.println("test"); pPlayer.getInventory().add(new ItemStack(ModItems.BOTTLE_CAP.get())); pPlayer.getInventory().removeItem(pPlayer.getInventory().selected, 1); pPlayer.getInventory().getItem(pPlayer.getInventory().selected).addTagElement("de-capped", new CompoundTag()); } return InteractionResult.CONSUME; } return InteractionResult.SUCCESS; } @Override @Nullable public BlockEntity newBlockEntity(@NotNull BlockPos pPos, @NotNull BlockState pState) { return new NukaColaMachineBlockEntity(pPos, pState); } @Nullable @Override public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level pLevel, @NotNull BlockState pState, @NotNull BlockEntityType<T> pType) { return createTickerHelper(pType, ModBlockEntities.NUKA_COLA_MACHINE.get(), NukaColaMachineBlockEntity::tick); } } Registration: public static final RegistryObject<Block> NUKA_COLA_MACHINE = registerBlock("nuka_cola_machine", () -> new NukaColaMachineBlock(BlockBehaviour.Properties.of(Material.METAL) .strength(5f).requiresCorrectToolForDrops().noOcclusion()));
-
[1.19.2] How do I make a custom armor model render on the player
DERPZ774 replied to DERPZ774's topic in Modder Support
Thank you! -
[1.19.2] How do I make a custom armor model render on the player
DERPZ774 replied to DERPZ774's topic in Modder Support
Wow i kinda botched this post my bad haven't really made many of these! -
So I made a model to render on the player but im confused on how to make it so when the player put the armor on that it renders on the player? Model Class: Item Class: (the initialize client method I used here was something I saw from another post I thought it was what I was missing but it still doesn't render) package com.derpz.nukaisl.item.custom; import com.derpz.nukaisl.client.models.UnderArmorModel; import com.derpz.nukaisl.item.ModArmorMaterials; import com.google.common.collect.ImmutableMap; import net.minecraft.client.Minecraft; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraftforge.client.extensions.common.IClientItemExtensions; import software.bernie.geckolib3.core.IAnimatable; import software.bernie.geckolib3.core.PlayState; import software.bernie.geckolib3.core.builder.AnimationBuilder; import software.bernie.geckolib3.core.controller.AnimationController; import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; import software.bernie.geckolib3.item.GeoArmorItem; import java.util.Collections; import java.util.Map; public class UnderArmorItem extends ArmorItem { public UnderArmorItem(ArmorMaterial pMaterial, EquipmentSlot pSlot, Properties pProperties) { super(pMaterial, pSlot, pProperties); } @Override public void initializeClient(java.util.function.Consumer<net.minecraftforge.client.extensions.common.IClientItemExtensions > consumer) { consumer.accept(new IClientItemExtensions() { public HumanoidModel getHumanoidArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) { HumanoidModel armorModel = new HumanoidModel(new ModelPart(Collections.emptyList(), Map.of("head", new UnderArmorModel<>(Minecraft.getInstance().getEntityModels().bakeLayer(UnderArmorModel.LAYER_LOCATION)).Body, "hat", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "body", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap())))); armorModel.crouching = living.isShiftKeyDown(); armorModel.riding = defaultModel.riding; armorModel.young = living.isBaby(); return armorModel; } }); } public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "nukaisl:textures/models/vault_suit_full.png"; } } P.S. : Still learning both Java and forge and completely understand if this is just a me being stupid thing
-
[1.18.2] Overriding player skin overlay after equipping certain armor
DERPZ774 replied to DERPZ774's topic in Modder Support
Wow I feel dumb now XD, tysm for all the help! -
[1.18.2] Overriding player skin overlay after equipping certain armor
DERPZ774 replied to DERPZ774's topic in Modder Support
Doing this fixed the server issue, however now the client wont load https://hastebin.com/yunamudeqi.properties Code : @Mod.EventBusSubscriber(modid = FalloutMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ModEventClientBusEvents { @SubscribeEvent public static void clientSetup(final FMLClientSetupEvent event) { ItemBlockRenderTypes.setRenderLayer(ModBlocks.LAMP.get(), RenderType.cutout()); ModItemProperties.addCustomItemProperties(); MenuScreens.register(ModMenuTypes.NUKA_COLA_OPENER_MENU.get(), NukaColaOpenerScreen::new); EntityRenderers.register(ModEntityTypes.TEST.get(), TestRenderer::new); } @SubscribeEvent public static void renderPlayerPre(RenderPlayerEvent.Pre event) { if (event.getPlayer().getInventory().getArmor(2).is(ModItems.VAULT_SUIT.get())) { event.getRenderer().getModel().leftSleeve.visible = false; event.getRenderer().getModel().rightSleeve.visible = false; //event.getRenderer().getModel().hat.visible = false; event.getRenderer().getModel().jacket.visible = false; event.getRenderer().getModel().leftPants.visible = false; event.getRenderer().getModel().rightPants.visible = false; event.getRenderer().getModel().head.visible = false; } /// TODO: 8/19/2022 edit statements here for all armor /// TODO: 8/20/2022 Fix server crashing } @SubscribeEvent public static void registerArmorRenderer(final EntityRenderersEvent.AddLayers event) { GeoArmorRenderer.registerArmorRenderer(UnderArmorItem.class, new UnderArmorRenderer()); /// TODO: 8/19/2022 Armor renders here } } -
[1.18.2] Overriding player skin overlay after equipping certain armor
DERPZ774 replied to DERPZ774's topic in Modder Support
I ran into an issue while running it on a server. https://hastebin.com/qajuvasifo.properties @SubscribeEvent public static void renderPlayerPre(RenderPlayerEvent.Pre event) { if (event.getPlayer().getInventory().getArmor(2).is(ModItems.VAULT_SUIT.get())) { event.getRenderer().getModel().leftSleeve.visible = false; event.getRenderer().getModel().rightSleeve.visible = false; //event.getRenderer().getModel().hat.visible = false; event.getRenderer().getModel().jacket.visible = false; event.getRenderer().getModel().leftPants.visible = false; event.getRenderer().getModel().rightPants.visible = false; event.getRenderer().getModel().head.visible = false; } /// TODO: 8/19/2022 edit statements here for all armor /// TODO: 8/20/2022 Fix server crashing } this is the code -
[1.18.2] Overriding player skin overlay after equipping certain armor
DERPZ774 replied to DERPZ774's topic in Modder Support
Thank you this worked! -
[1.18.2] Different item model for inventory/held in hand
DERPZ774 replied to DERPZ774's topic in Modder Support
Thank you! -
Trying to make an item in the inventory render differently than what it renders in the hand like how the spyglass and trident items do it. How would I go about doing this?