Jump to content

FREyebeans2506

Members
  • Posts

    16
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

FREyebeans2506's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I am attempting to make a belt sander that when you click on the central button it creates the respective output defined by recipe jsons. It almost works however when i try to take the items from the result slots they disappear and when i take from either of the input slots i get the item i put in and not what it says is there. What did i do wrong? sandItems method public void sandItems() { LOGGER.info(hasRecipe(this)?"Sanding!":"Sanding failed :("); if (hasRecipe(this)) { ItemStack stack = this.inputSlot.getItem(0); boolean flag = !this.bookSlot.isEmpty() && stack.isEnchanted(); SandingRecipe recipe = getRecipe(this); this.resultSlots.addItem(flag?recipe.getResultItem():enchantedOutput(recipe,stack)); for (ItemStack item: recipe.rollResults()) { this.resultSlots.addItem(item); } if(flag) { ItemStack stack0 = this.bookSlot.getItem(0); if(!stack.is(Items.ENCHANTED_BOOK)) { stack0 = Items.ENCHANTED_BOOK.getDefaultInstance().copy(); } EnchantmentHelper.setEnchantments(EnchantmentHelper.getEnchantments(stack),stack0); this.bookSlot.setItem(0,stack0); } stack.shrink(1); this.inputSlot.setItem(0,stack); } } button class package com.freyebeans.mgdim.inventory; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.components.AbstractButton; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.narration.NarratedElementType; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import java.util.function.Consumer; @OnlyIn(Dist.CLIENT) public class SandButton extends AbstractButton { private final ResourceLocation resourceLocation; private final BeltSanderMenu menu; private final BeltSanderScreen screen; private int leftPos; private int imageHeight; private int imageWidth; public SandButton(BeltSanderScreen screen, BeltSanderMenu menu, int imgh, int imgw, int lpos, ResourceLocation rl){ super(lpos + 73,((screen.height - imgh) / 2) + 15,30,63, new TranslatableComponent("container.sander.sand")); this.menu = menu; this.screen = screen; this.resourceLocation = rl; leftPos = lpos; imageHeight = imgh; imageWidth = imgw; } public void screenSync(int imgh, int imgw, int lpos){ leftPos = lpos; imageHeight = imgh; imageWidth = imgw; this.x = lpos + 73; this.y = ((screen.height - imgh) / 2) + 15; } public void renderButton(PoseStack p_94282_, int p_94283_, int p_94284_, float p_94285_){ RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, this.resourceLocation); int i = this.leftPos; int j = (screen.height - this.imageHeight) / 2; int k = 60; if (!menu.inputSlot.getItem(0).isEmpty()) { k -= this.isHoveredOrFocused() ? 30 : 60; } RenderSystem.enableDepthTest(); this.blit(p_94282_, i + 73, j + 15, k, this.imageHeight, 30, 63); } @Override public void onPress() { menu.sandItems(); } @Override public void updateNarration(NarrationElementOutput p_169152_) { } }
  2. Ive been trying all day to get the entity to show up but it just stays invisible apart from its shadow and hit box(F3+B). google is dumb and changes the url for the image constantly all 6 relevant classes i did take most of this from the boat code because it was most similar to what i am making.
  3. i have tried several things to get it to change when the day changes to night i can only get it to be lit up if i place it at night package com.freyebeans2506.faltthethe.contentfeatures.blocks; import net.minecraft.block.BedBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.LightType; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import javax.annotation.Nullable; import java.util.Random; public class ABBlock extends Block { public static final BooleanProperty LIT = BlockStateProperties.LIT; public ABBlock(Properties properties) { super(properties); this.registerDefaultState(this.stateDefinition.any().setValue(LIT, Boolean.valueOf(false))); } @Nullable public BlockState getStateForPlacement(BlockItemUseContext p_196258_1_) { return this.defaultBlockState().setValue(LIT, Boolean.valueOf(p_196258_1_.getLevel().isNight())); } protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) { p_206840_1_.add(LIT); } } this has been causing me pain for the past 3 hours
  4. so i just thought for a few more minutes and managed to get it to work with .with(AXIS, state.get(AXIS)) thank you guys so much for the help
  5. does this make the stripped stem and the stem the same block
  6. I've been working on a mod for about a week and have made a block strippable but the log points up when stripped and I dont know how to fix it here's some of my code StrippableStem class public class StrippableStem extends RotatedPillarBlock { private final BlockState stripped; public StrippableStem(BlockState state, Properties properties) { super(properties); this.stripped = state; } @Override @Nullable public BlockState getToolModifiedState(BlockState state, World world, BlockPos pos, PlayerEntity player, ItemStack stack, ToolType toolType) { return toolType == ToolType.AXE ? stripped : null; } } the logs register public static final RegistryObject<Block> MUSHROOM_STEM = BLOCKS.register("mushroom_stem", ()-> new StrippableStem(STRIPPED_MUSHROOM_STEM.get().getDefaultState(), AbstractBlock.Properties.create(Material.WOOD) .hardnessAndResistance(0.5f,2.0f) .harvestTool(ToolType.AXE) .harvestLevel(0) .sound(SoundType.HYPHAE) )); I'm assuming the issue is .getDefaultState but I'm not sure if this is the issue or how to fix the issue
  7. I’ll try that also by semi-transparent I mean 50% opacity
  8. i can only seem to get blocks to render semi transparent with x ray or opaque with out x ray here is the code ive tried RenderTypeLookup.setRenderLayer(RegistryHandler.ROUGH_GLASS.get(), RenderType.getTranslucent()); RenderTypeLookup.setRenderLayer(RegistryHandler.ROUGH_GLASS.get(), RenderType.getCutout()); RenderTypeLookup.setRenderLayer(RegistryHandler.ROUGH_GLASS.get(), RenderType.getCutoutMipped()); how can i make it semi transparent and not x ray
  9. I managed to get it to work using my knowledge of voxel shape so thanks foonicular
  10. foonicular i dont know how to use RenderTypeLookup
  11. i dont get what you mean copy the air model
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.