Jump to content

NullDev

Members
  • Posts

    64
  • Joined

  • Last visited

Everything posted by NullDev

  1. I have done that, but now the entity is just invisible... I uploaded the new code to the repository.
  2. https://github.com/AyliasTheCoder/TheSecretsOfRetexturedMC
  3. Corrupt Pearl Entity package com.aylias.minecraft.mods.modbase.entities; import com.aylias.minecraft.mods.modbase.util.CorruptPearlReboundEvents; import com.aylias.minecraft.mods.modbase.util.EntityRegisters; import com.aylias.minecraft.mods.modbase.util.RegistryHandler; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.entity.ArrowRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.item.EnderPearlEntity; import net.minecraft.entity.monster.EndermiteEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.EntityRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; public class CorruptPearlEntity extends EnderPearlEntity { CorruptPearlReboundEvents.Rebounder toActivate; public CorruptPearlEntity(World worldIn, LivingEntity throwerIn) { super(worldIn, throwerIn); CorruptPearlReboundEvents.addRebounder(throwerIn); toActivate = CorruptPearlReboundEvents.toRebound.get(CorruptPearlReboundEvents.toRebound.size() - 1); } public CorruptPearlEntity(World worldIn, double x, double y, double z) { super(worldIn, x, y, z); } public CorruptPearlEntity(EntityType<? extends EnderPearlEntity> p_i50153_1_, World p_i50153_2_) { super(p_i50153_1_, p_i50153_2_); } @Override protected void onImpact(RayTraceResult result) { toActivate.activate(); super.onImpact(result); } @Override protected Item getDefaultItem() { return RegistryHandler.CORRUPT_PEARL.get(); } }
  4. I have already done that, but it just assumes the texture of the normal ender pearl not the one attached to the corrupt pearl item, even if I don't register the CorruptPearlRenderer it still just looks like an ender pearl. @Override protected Item getDefaultItem() { return RegistryHandler.CORRUPT_PEARL.get(); }
  5. So I have created this class for rendering a projectile that extends SpriteRenderer, but when I try to override getEntityTexture I get this error: 'getEntityTexture(Entity)' in 'com.aylias.minecraft.mods.modbase.client.renders.CorruptPearlRenderer' clashes with 'getEntityTexture(T)' in 'net.minecraft.client.renderer.entity.EntityRenderer'; both methods have same erasure, yet neither overrides the other How do I override it without getting this error? I have tried googling the error, even as just "both methods have same erasure, yet neither overrides the other" but found nothing that can help. Here is the class: package com.aylias.minecraft.mods.modbase.client.renders; import com.aylias.minecraft.mods.modbase.ModBase; import com.aylias.minecraft.mods.modbase.entities.CorruptPearlEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.SpriteRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.client.registry.IRenderFactory; @OnlyIn(Dist.CLIENT) public class CorruptPearlRenderer extends SpriteRenderer<CorruptPearlEntity> { public CorruptPearlRenderer(EntityRendererManager renderManagerIn, ItemRenderer itemRendererIn) { super(renderManagerIn, itemRendererIn); } @Override public ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation(ModBase.MODID, "textures/item/corrupt_pearl.png"); } public static class RenderFactory implements IRenderFactory<CorruptPearlEntity> { @Override public EntityRenderer<? super CorruptPearlEntity> createRenderFor(EntityRendererManager manager) { manager.setRenderShadow(false); return new CorruptPearlRenderer(manager, Minecraft.getInstance().getItemRenderer()); } } }
  6. I found what vanilla uses but it doesn't seem to do anything: @SubscribeEvent public static void playerDamage(LivingHurtEvent e) { if (e.getEntityLiving() instanceof ServerPlayerEntity) { System.out.println("I AM A SERVER PLAYER"); ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)e.getEntityLiving(); serverplayerentity.addStat(Stats.ITEM_USED.get(RegistryHandler.TOTEM_OF_DYING.get())); CriteriaTriggers.USED_TOTEM.trigger(serverplayerentity, new ItemStack(RegistryHandler.TOTEM_OF_DYING.get())); } } I see "I AM A SERVER PLAYER" in the console, but no animation seems to play, and this is the only part that is in the LivingEntity class relating to the totem of undying. I don't currently have it check if the player is holding a totem, for ease of testing. The player stats for used totem of dying goes up, but no animation plays. That is the only place in the code that I can find that seems to have a connection to the totems revival. It also gives all the effects within the same function which isLivingEntity.checkTotemDeathProtection()
  7. I also tried this, because vanilla seems to use matrixStackIn.push() but still nothing: final CorruptPearlModel model = new CorruptPearlModel(); @Override public void render(CorruptPearlEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { matrixStackIn.push() model.render(matrixStackIn, bufferIn.getBuffer(RenderType.getEntityTranslucent(getEntityTexture(entityIn))), packedLightIn, 0, 0, 0, 0, 1); }
  8. I am looking for the code that makes Totems of Undying work, because I am trying to make my own version, but the code doesn't exist within the code of the item itself, so where would I find the code for it? I only need to code for the animation it plays, I already know how to detect if an entity is holding the custom totem.
  9. I added this to my code, but it is still appearing untextured: final CorruptPearlModel model = new CorruptPearlModel(); @Override public void render(CorruptPearlEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { model.render(matrixStackIn, bufferIn.getBuffer(RenderType.getEntityTranslucent(getEntityTexture(entityIn))), packedLightIn, 0, 0, 0, 0, 1); } I cannot seem to find an entity renderer or model for ender pearls
  10. So I am creating an entity that functions like an ender pearl, and I have created the entity and registered a renderer, but I cannot find anywhere to register the model. Here is my code: https://github.com/AyliasTheCoder/TheSecretsOfRetexturedMC
  11. For anyone else with this issue, I figured it out. Do this for each new StringTextComponent: toReturn.func_230529_a_( new StringTextComponent("New Text With New Color").func_240701_a_(TextFormatting.WHITE) ) I call the mergestyle on the new StringTextComponent that I am adding with the appendText function.
  12. Sorry it took me so long, but here you go. I am trying to build it block by block from a tileentity. The code for the building is in the OneBlockBuilderTileEntityAbstract class. I currently have my own system implemented, but I'd prefer to use schematics, because those will be easier for complex structures. https://github.com/AyliasTheCoder/OneBlockADayForge
  13. So how would I do it without overriding it?
  14. I changed it to this and it is still all black: StringTextComponent toSend = new StringTextComponent("Info: "); player.sendStatusMessage(toSend.func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(ticksRemaining/20 + " | ")) .func_240701_a_(TextFormatting.RED) .func_230529_a_(new StringTextComponent(Integer.toString(redstoneAdded))) .func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(" | ")) .func_240701_a_(TextFormatting.GREEN) .func_230529_a_(new StringTextComponent(Integer.toString(emeraldAdded))) .func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(" | ")) .func_240701_a_(TextFormatting.AQUA) .func_230529_a_(new StringTextComponent(Integer.toString(diamondAdded))) .func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(" | ")) .func_240701_a_(TextFormatting.BLACK) .func_230529_a_(new StringTextComponent(Integer.toString(coalAdded))), true);
  15. I've done that like this, but now it just appears all black IFormattableTextComponent toSend = new StringTextComponent("Info: "); toSend.func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(ticksRemaining/20 + " | ")) .func_240701_a_(TextFormatting.RED) .func_230529_a_(new StringTextComponent(Integer.toString(redstoneAdded))) .func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(" | ")) .func_240701_a_(TextFormatting.GREEN) .func_230529_a_(new StringTextComponent(Integer.toString(emeraldAdded))) .func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(" | ")) .func_240701_a_(TextFormatting.AQUA) .func_230529_a_(new StringTextComponent(Integer.toString(diamondAdded))) .func_240701_a_(TextFormatting.WHITE) .func_230529_a_(new StringTextComponent(" | ")) .func_240701_a_(TextFormatting.BLACK) .func_230529_a_(new StringTextComponent(Integer.toString(coalAdded))); player.sendStatusMessage(toSend, true);
  16. I am having some issues with text formatting. I format my text like this: player.sendStatusMessage(new StringTextComponent(ticksRemaining/20 + " §f| §4" + redstoneAdded + " §f| §a" + emeraldAdded + " §f| §b" + diamondAdded + " §f| §0" + coalAdded), true) and it appears like this in the game chat:
  17. It turns out using TemplateManager manager = world.getServer().func_241755_D_().getStructureTemplateManager(); crashes if its a singleplayer world, even with the !world.isRemote, so how else do I get the TemplateManager? And I think to get the blocks I just do BlockPos temp = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()); template.func_215386_a(temp, new PlacementSettings(), Blocks.ACACIA_WOOD, true);
  18. Alright. It seems it uses TemplateManager, and I have figured out how to get that, ang grab a Template using it, but how do I get the blocks from said template? if (!world.isRemote) { TemplateManager manager = world.getServer().func_241755_D_().getStructureTemplateManager(); Template template = manager.getTemplate(new ResourceLocation(ModBase.MODID, "schematics/small_house")); }
  19. I am creating a mod that has blocks that build structures, but I don't want to code in each of the positions for blocks by hand, so I want to use schematics. How would I start going about reading a schematic with forge?
  20. I have created a custom crafting table in my mod, and it extends the "CraftingTableBlock" class. For whatever reason, when I right click on it the gui opens, and then immediately closes. How do I make it not close? Do I need a gui that extends WorkbenchContainer?
  21. No. I have been trying to get the fluid working before I make those. Do I need the mcmeta for the physics to work?
  22. I have modded a fluid into the game, but it does not push entities like water does, nor does it allow the player to float in it. I have tried adding .density(1) and .viscosity(1) in the fluid attributes builder, but it did nothing. There is also nothing in the water class that shows how the player can float in it. My Class: package com.nulldev.modbase.blocks; import com.nulldev.modbase.ModBase; import com.nulldev.modbase.util.CustomFluids; import com.nulldev.modbase.util.RegistryHandler; import net.minecraft.block.BlockState; import net.minecraft.block.FlowingFluidBlock; import net.minecraft.fluid.FlowingFluid; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.WaterFluid; import net.minecraft.item.Item; import net.minecraft.state.StateContainer; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fml.RegistryObject; public abstract class RedWater extends FlowingFluid { @Override public Fluid getFlowingFluid() { return CustomFluids.flowingRedWater; } @Override public Fluid getStillFluid() { return CustomFluids.redWater; } @Override protected boolean canSourcesMultiply() { return false; } @Override protected void beforeReplacingBlock(IWorld worldIn, BlockPos pos, BlockState state) { } @Override protected int getSlopeFindDistance(IWorldReader worldIn) { return 1; } @Override protected int getLevelDecreasePerBlock(IWorldReader worldIn) { return 1; } @Override public Item getFilledBucket() { return RegistryHandler.RED_WATER_BUCKET.get(); } @Override protected boolean canDisplace(FluidState p_215665_1_, IBlockReader p_215665_2_, BlockPos p_215665_3_, Fluid p_215665_4_, Direction p_215665_5_) { return true; } @Override public int getTickRate(IWorldReader p_205569_1_) { return 5; } @Override protected float getExplosionResistance() { return 100; } @Override protected BlockState getBlockState(FluidState state) { return RegistryHandler.RED_WATER.get().getDefaultState().with(FlowingFluidBlock.LEVEL, Integer.valueOf(getLevelFromState(state))); } @Override public boolean isEquivalentTo(Fluid fluidIn) { return fluidIn == CustomFluids.redWater || fluidIn == CustomFluids.flowingRedWater; } @Override protected FluidAttributes createAttributes() { return FluidAttributes.builder(RegistryHandler.location("blocks/red_water_still"), RegistryHandler.location("blocks/red_water_flowing")) .translationKey("block." + ModBase.MODID + ".red_water") .density(1) .viscosity(2) .build(this); } public static class Flowing extends RedWater { @Override protected void fillStateContainer(StateContainer.Builder<Fluid, FluidState> builder) { super.fillStateContainer(builder); builder.add(LEVEL_1_8); } @Override public boolean isSource(FluidState state) { return false; } @Override public int getLevel(FluidState state) { return state.get(RedWater.LEVEL_1_8); } } public static class Source extends RedWater { @Override public boolean isSource(FluidState state) { return true; } @Override public int getLevel(FluidState state) { return 8; } } } I had seen another post that said to put this in data/minecraft/tags/fluids: { "replace": false, "values": [ "tso_blocksdrawing:still_red_water", "tso_blocksdrawing:flowing_red_water" ] } but that produced this error when I tried loading the world: Couldn't load fluid tag minecraft:water as it is missing following references: tso_blocksdrawing:still_red_water (from main),tso_blocksdrawing:flowing_red_water (from main)
  23. Alright, so I have done that, but I cannot use the same rayTrace method that the bottle uses because it is protected, so how do I find the fluid that was clicked? @SubscribeEvent public static void playerRightClickItem(PlayerInteractEvent.RightClickItem event) { System.out.println("Player Right Clicked!"); World worldIn = event.getWorld(); PlayerEntity playerIn = event.getPlayer(); if (event.getPlayer().getHeldItem(event.getHand()).getItem() == Items.GLASS_BOTTLE) { RayTraceResult raytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.SOURCE_ONLY); //Error: 'rayTrace(net.minecraft.world.World, net.minecraft.entity.player.PlayerEntity, net.minecraft.util.math.RayTraceContext.FluidMode)' has protected access in 'net.minecraft.item.Item' if (raytraceresult.getType() == RayTraceResult.Type.MISS) { } else { if (raytraceresult.getType() == RayTraceResult.Type.BLOCK) { BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).getPos(); if (worldIn.getFluidState(blockpos).getFluid() instanceof RedWater) { worldIn.playSound(playerIn, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.NEUTRAL, 1.0F, 1.0F); turnBottleIntoItem(event.getPlayer().getHeldItem(event.getHand()), event.getPlayer(), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.HEALING)); } } } } }
  24. I have created and registered a fluid, and I want to give entities effects while they are in the fluid, so how do I detect what entities are in the fluid?
  25. I have added and registered a fluid, and I need to detect when the player right clicks the fluid with a bottle, but there is no way to detect that within the class extending FlowingFluid, and if I use onBlockActivated in the class extending FlowingFluidBlock, nothing happens. It seems vanilla Minecraft detects it within the bottle itself, so where would I detect a bottle clicking my fluid at?
×
×
  • Create New...

Important Information

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