Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by tt36999

  1. I want to create new enchantment called "AutoSmelting", it will change Iron ore to iron ingot, wood log to charcoal when harvest block. How can i do this thing? I saw mc 1.16.5 use loot table to process enchantments like fortune and silk touch drop. Is that mean I need traversal all loot table in LootTableLoadEvent, and add new function to every loot table whitch has a smelting recipe? Or any other way to do this? thanks a lot
  2. I have confused between attribute and capability Should i add new custom attribute to vanilla entity? If i want add a custom attribute(e.g. add Mental state as a second Health Bar) to LivingEntity, whitch should i use? I want vanilla Effect system work with my custom attribute sorry for my english 😆
  3. My tileentity have two fluid tank and i want fill one of tanks when right click this block with fluid bucket. But when i test my tileentity, the sever side(when world.isRemote == flase)tank always null when block actived, client side working properly @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack itemHeld = playerIn.getHeldItem(hand); IFluidHandlerItem handlerItem = FluidUtil.getFluidHandler(itemHeld); if (handlerItem != null) { TileEntityPurifier purifier = (TileEntityPurifier) worldIn.getTileEntity(pos);// BreakPoint 1 in this line server side tileentity's tank always empty IItemHandler iItemHandler = new InvWrapper(playerIn.inventory); FluidActionResult emptyResult = FluidUtil.tryEmptyContainerAndStow(itemHeld, purifier.tank, iItemHandler, purifier.tank.getCapacity(), playerIn, true);//I break this line , idea show me fluid has filled into tileentity, both side fluid amoount changed if (emptyResult.isSuccess()) { playerIn.setHeldItem(hand, emptyResult.getResult()); worldIn.markChunkDirty(pos, purifier); return true; } FluidActionResult fillResultOut = FluidUtil.tryFillContainerAndStow(itemHeld, purifier.outputTank, iItemHandler, purifier.outputTank.getFluidAmount(), playerIn, true); if (fillResultOut.isSuccess()) { playerIn.setHeldItem(hand, fillResultOut.getResult()); worldIn.markChunkDirty(pos, purifier); return true; } FluidActionResult fillResult = FluidUtil.tryFillContainerAndStow(itemHeld, purifier.outputTank, iItemHandler, purifier.tank.getFluidAmount(), playerIn, true); if (fillResult.isSuccess()) { playerIn.setHeldItem(hand, fillResult.getResult()); worldIn.markChunkDirty(pos, purifier); return true; } } else { BrewingCraft.openGui(playerIn, getGui(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; } return false; } any idea to fix this?
  4. OK,I don't want debate this with you, maybe you are right or maybe my, i will try your proposal and remove the common, i hope this can fix my issue.
  5. I don't think is no sense, in my mod most situation client need more code than server, and server proxy even hasn't any code then common. so i just make common to do what serverproxy do, and client extened it , so i can override it. for example if someone write code in proxy to getServerGuiElement and getClientGuiElement(i won't do that , just for example) in common it can return a container for server , and in clientproxy it can use common get container and return gui element. client proxy will become an extension of common, and sometime will different from common
  6. OK,I just don't like write all my code in main file , ClientProxy was extends from CommonProxy, I has a ServerProxy too, if one side need different code , i just override it from CommonProxy I removed it, and do this in client
  7. I have seen this error when using wrong Optifine version maybe you can try to use other version optifine or just delete it
  8. I'm working for my mod,and when i want to make a gui to my block i got this problem. When i right my block , onBlockActived method was run without any error.but my gui handler never called this is main file @Mod.Instance public static BrewingCraft instance; @Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.onInit(event); } this is commonproxy(some potion,player event code in this file,i think it's no need to show them) @Override public void onInit(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(BrewingCraft.instance, new BRCGuiHandler()); } here is GuiHandler public class BRCGuiHandler implements IGuiHandler { @Nullable @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BrewingCraft.logger.info("Get server con " + ID);//never show in colsole switch (ID) { case 0: return new ContainerTestBlock(player.inventory, (TileEntityFluidContainer) world.getTileEntity(new BlockPos(x, y, z))); } BrewingCraft.logger.warn("[Warning] Can not get server gui container with id is " + ID); return null; } @Nullable @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BrewingCraft.logger.info("Get client gui " + ID);//never show in colsole switch (ID) { case 0: return new GuiTestFluidContainer((ContainerBRC) getServerGuiElement(ID, player, world, x, y, z), player.inventory); } BrewingCraft.logger.warn("[Warning] Can not get client gui object with id is " + ID); return null; } this is my block onBlockActive method @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { final IFluidHandler fluidHandler = getFluidHandler(worldIn, pos); if (fluidHandler != null) { ItemStack heldItem = playerIn.getHeldItem(hand); if (!CapabilityUtils.hasCapability(heldItem, CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { if (!worldIn.isRemote) { if (hasGui()) { BrewingCraft.logger.info("Open Gui " + getGui().getId());//this code line show text in colsole //BrewingCraft.openGui(playerIn, getGui(), worldIn, pos.getX(), pos.getY(), pos.getZ());//forget this is just a test code playerIn.openGui(BrewingCraft.instance, getGui().getId(), worldIn, pos.getX(), pos.getY(), pos.getZ()); } else { IFluidTankProperties[] properties = fluidHandler.getTankProperties(); StringBuilder builder = new StringBuilder(); for (IFluidTankProperties tankProperties : properties) builder.append(tankProperties.getContents().getLocalizedName() + ":" + tankProperties.getContents().amount + "/" + tankProperties.getCapacity()); playerIn.sendStatusMessage(new TextComponentString(builder.toString()), false); } } return true; } FluidUtil.interactWithFluidHandler(playerIn, hand, fluidHandler); return FluidUtil.getFluidHandler(playerIn.getHeldItem(hand)) != null; } return false; } any one know how to fix this?maybe i make some mistake in my code
  9. I want create a item with gui, this gui will show inventory in this item. I use public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { return new ItemInventoryProvider(limit); } this to init capalities to my item, the "ItemInventoryProvider" Instantiation a ItemStackHandler in it's construct public class ItemInventoryProvider implements ICapabilitySerializable<NBTTagCompound> { public final ItemStackHandler inventory; public ItemInventoryProvider(int size) { inventory = new ItemStackHandler(size); } @Override public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) { return capability == ITEM_HANDLER_CAPABILITY; } @Nullable @Override public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) { return hasCapability(capability, facing) ? ITEM_HANDLER_CAPABILITY.<T>cast(inventory) : null; } @Override public NBTTagCompound serializeNBT() { return inventory.serializeNBT(); } @Override public void deserializeNBT(NBTTagCompound nbt) { inventory.deserializeNBT(nbt); } } But when i want create container for my item's gui i got some problem. method addSlotToContainer(new Slot((IInventory) inventory, id, x, y)); need a IInventory to add slot, but i use IItemHandler in my item, what should i do?
  10. I have some problem whit item nbt. I created a item with some nbt data, but when i add tooltip and durability bar to the item , the tooltip and durability bar didn't update at all @Override public double getDurabilityForDisplay(ItemStack stack) { return (getDurable(stack) / getMaxDurable(stack)); } @Override public boolean showDurabilityBar(ItemStack stack) { return true; } @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { tooltip.add(I18n.format("tooltip.test") + ": " + getDurable(stack)); } These code are written in my item class this ItemStack was created by my machine, I use custom recipe handler class and add nbt tag before apply output(all these code run in server side, i use !world.isRemote to ensure all checkCanCraft , costInputItem and applyOutPut run in server) I think maybe nbt data didn't sync to client, and tried log NBT data in showDurabilityBar method when i use MOD.logger.info(getTagCompound().getCompoundTag("ma_data").toString()); console show me right nbt data string like "{"ma_data":{"Durable":1000.0}}" but when i use MOD.logger.info(getTagCompound().getCompoundTag("ma_data").getDouble("Durable"));//this line show me 0.0d in console MOD.logger.info(getTagCompound().getCompoundTag("ma_data").getTag("Durable"));// this line show me null in console I am sure of the item has correct nbt(At least in server side) What am I doing wrong?
  11. Hello guys, I'm a beginer for minecraft modding,when i try to make some item ,i got this question. I want my item has two different "durable" (eg. One is the real durable , another show how many fluids this item contained, and when item contatined lava, this item will gradually melt down) what show i do for this item? Is there any way to draw two durable bar in one item? Or i should show fluid amount in item tooltip? I'm working for mc 1.12 forge 2705 thanks everyone whatevery you can help me or not
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.