Jump to content

Lea9ue

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by Lea9ue

  1. Trying to replace Vanilla Zombie with custom entity. With code, I am having random game hangs. Only Occasionally so its hard to tell exact problem. Game occasionally hangs at 100% when loading. Other times it hangs when playing. Never crashes, just everything freezes except player, Player can still move around in loaded chucks but cant interact with anything. Any ideas? @SubscribeEvent public void copyZombie(final EntityJoinWorldEvent event) { World world = event.getEntity().world; if (!world.isRemote) { if (event.getEntity() instanceof ZombieEntity) { if (!(event.getEntity() instanceof ZombieCopyEntity)) { ZombieEntity zombie = (ZombieEntity) event.getEntity(); ZombieCopyEntity copy = new ZombieCopyEntity(EntityReg.ZOMBIECOPY, world); copy.setPosition(zombie.getPosition().getX(), zombie.getPosition().getY(), zombie.getPosition().getZ()); event.setCanceled(true); world.addEntity(copy); } } } }
  2. I'm trying and failing with this: @SubscribeEvent public void zombieSpawn(EntityJoinWorldEvent event) { if (isRemoveZombieGoal()) { World world = event.getEntity().world; if (!world.isRemote) { if (event.getEntity() instanceof ZombieEntity) { System.out.println("should remove"); ZombieEntity zombie = (ZombieEntity) event.getEntity(); zombie.targetSelector.removeGoal(new NearestAttackableTargetGoal<>(zombie, PlayerEntity.class, true)); zombie.goalSelector.removeGoal(new ZombieAttackGoal(zombie, 1.0D, false)); } } } } What am I doing wrong here. I do get console message.
  3. You need to show your code. CANNOT help if you dont. Show your UnicornEntityModel class first.
  4. There is literally zero reasons for you to be using Tabula or BlockBench to add a horn to a horse. You already have Horsemodel. You already have a texture file for a horse that you can add texture to make the horn. I have a feeling that you are just lost. You should then add a box like I said before to your model class. this.corn.addBox(.....); Then right here is the coordinates of the texture on the png. this.corn = new RendererModel(this, number, number); The 2 numbers tell exactly where the texture is located on png.
  5. You should add box for your entities "corn". Render it in then just copyModelAngles of the head. See vahnilla code for how it copys headwear to head.
  6. In your item class you should have something like... @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { if (toRepair.getItem().equals("YOUR ITEM") && repair.getItem().equals("WHAT REPAIRS IT")) { return true; } else { return false; } }
  7. Maybe because you're removing entity while ticking or something like that. At least that's the error I am see while trying to use livingTick() and making an entity explode. Possibly move the blowUp parts out of livingTick() and put them under tick(). see CreeperEntity.
  8. what is posX, posY, posZ? I'm not very good at "this" but I think you need "this".
  9. event.getSource().getTrueSource and check if instanceof Player. Post your code if you want more help.
  10. Look under item. I believe you need to override onBlockStartBreak.
  11. I have a general question in regards to how I am formatting my code with event handlers. Is there a benefit with efficiency (lag) between 1 event handler checking and doing multiple things vs many of the same event handlers checking for 1 thing. I give two 2 rough examples: Example1: @SubscribeEvent public void creeperCheck(LivingDeath event){ if(event.getEntity instanceof CreeperEntity){ ... } } @SubscribeEvent public void zombieCheck(LivingDeath event){ if(event.getEntity instanceof ZombieEntity){ ... } } @SubscribeEvent public void skeletonCheck(LivingDeath event){ if(event.getEntity instanceof SkeletonEntity){ ... } } Vs Example 2: @Subscribe @SubscribeEvent public void deathCheck(LivingDeathEvent event){ if(event.getEntity instanceof CreeperEntity){ ... } if(event.getEntity instanceof ZombieEntity){ ... } if(event.getEntity instanceof SkeletonEntity){ ... } }
  12. And is it a custom texture? If so, is background transparent, or white? If transparent then I would make a block class that extends BushBlock.
  13. BlockRenderLayer.CUTOUT_MIPPED, I think it's usually black though. Is your texture background white?
  14. I would assume BreakEvent in BlockEvent would be able to do something for you. If that don't work possibly HarvestEvent.
  15. Having issues figuring out Structures. I tried multiple ways but obviously its not going well since I'm here. Here are my classes incase anyone could help. Structure Class: public class TestStructure extends ScatteredStructure<NoFeatureConfig> { public TestStructure(Function<Dynamic<?>, ? extends NoFeatureConfig> config) { super(config); } @Override protected int getSeedModifier() { return 11111111; } @Override public IStartFactory getStartFactory() { return Start::new; } @Override public String getStructureName() { return MobWar.MODID + ":test_structure"; } @Override public int getSize() { return 1; } public static class Start extends StructureStart { public Start(Structure<?> structure, int chunkX, int chunkZ, Biome biome, MutableBoundingBox boundingBox, int references, long seed) { super(structure, chunkX, chunkZ, biome, boundingBox, references, seed); } @Override public void init(ChunkGenerator<?> generator, TemplateManager templateManager, int chunkX, int chunkZ, Biome biome) { ResourceLocation templateResource; if(this.rand.nextBoolean()) { templateResource = new ResourceLocation(MobWar.MODID, "diamond_temple"); } else { templateResource = new ResourceLocation(MobWar.MODID, "diamond_temple_2"); } Rotation rotation = Rotation.values()[this.rand.nextInt(Rotation.values().length)]; TestPiece testPiece = new TestPiece(templateManager, templateResource, new BlockPos(chunkX * 16, 0, chunkZ * 16), rotation); this.components.add(testPiece); this.recalculateStructureSize(); } } } Structure Piece: public class TestPiece extends TemplateStructurePiece { private final ResourceLocation templateResource; private final Rotation rotation; public TestPiece(TemplateManager templateManager, ResourceLocation templateResource, BlockPos pos, Rotation rotation) { super(TestStructureRegisty.TEST_STRUCTURE_PIECE, 0); this.templateResource = templateResource; this.templatePosition = pos; this.rotation = rotation; setupTemplate(templateManager); } public TestPiece(TemplateManager templateManager, CompoundNBT nbt) { super(TestStructureRegisty.TEST_STRUCTURE_PIECE, nbt); this.rotation = Rotation.valueOf(nbt.getString("rot")); this.templateResource = new ResourceLocation(nbt.getString("temp")); setupTemplate(templateManager); } private void setupTemplate(TemplateManager templateManager) { Template template = templateManager.getTemplateDefaulted(this.templateResource); PlacementSettings placementsettings = (new PlacementSettings()).setRotation(this.rotation).setCenterOffset(new BlockPos(3, 0, 4)).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); this.setup(template, this.templatePosition, placementsettings); } @Override protected void readAdditional(CompoundNBT nbt) { super.readAdditional(nbt); nbt.putString("rot", this.rotation.name()); nbt.putString("temp", this.templateResource.toString()); } @Override protected void handleDataMarker(String function, BlockPos pos, IWorld world, Random rand, MutableBoundingBox boundingBox) { if("chest".equals(function)) { LockableLootTileEntity.setLootTable(world, rand, pos.down(), LootTables.CHESTS_SIMPLE_DUNGEON); } } @Override public boolean addComponentParts(IWorld world, Random rand, MutableBoundingBox boundingBox, ChunkPos chunkPos) { float height = 0; BlockPos structureSize = this.templatePosition.add(this.template.getSize().getX() - 1, 0, this.template.getSize().getZ() - 1); for(BlockPos pos : BlockPos.getAllInBoxMutable(this.templatePosition, structureSize)) { int k = world.getHeight(Heightmap.Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ()); height += k; } height = height / (this.template.getSize().getX() * this.template.getSize().getZ()) - 1; this.templatePosition = new BlockPos(this.templatePosition.getX() + 8, height, this.templatePosition.getZ() + 8); return super.addComponentParts(world, rand, boundingBox, chunkPos); } } Registry: @Mod.EventBusSubscriber(modid = MobWar.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) @ObjectHolder(MobWar.MODID) public class TestStructureRegisty { public static final Structure<NoFeatureConfig> TEST_STRUCTURE = new TestStructure(NoFeatureConfig::deserialize); public static IStructurePieceType TEST_STRUCTURE_PIECE; @SubscribeEvent public static void registerFeatures(RegistryEvent.Register<Feature<?>> event) { TEST_STRUCTURE_PIECE = Registry.register(Registry.STRUCTURE_PIECE, MobWar.MODID + ":test_structure", TestPiece::new); TestStructure testStructure = new TestStructure(NoFeatureConfig::deserialize); testStructure.setRegistryName(MobWar.MODID, "test_structure"); event.getRegistry().register(testStructure); } private static void addOverworldStructures(Biome biome) { biome.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Biome.createDecoratedFeature(TEST_STRUCTURE, IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); } } When I use command /locate it shows mobwar:dimond_temple, so I believe that is registering correctly but I can not located structure in my custom dimension. Also here is my biome class: public class DiamondBiome extends Biome { public DiamondBiome(){ super((new Biome.Builder()) .surfaceBuilder(new ConfiguredSurfaceBuilder<SurfaceBuilderConfig>(SurfaceBuilder.DEFAULT, new SurfaceBuilderConfig(Blocks.GRASS_BLOCK.getDefaultState(), Blocks.STONE.getDefaultState(), Blocks.CLAY.getDefaultState()))) .precipitation(RainType.NONE) .downfall(0.0f) .category(Category.NONE) .temperature(1.0f) .scale(.2f) .depth(.3f) .waterColor(0x2bf0e6) .waterFogColor(0x2bf0e6) .parent(null) ); this.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Biome.createDecoratedFeature(TestStructureRegisty.TEST_STRUCTURE, IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); this.addStructure(TestStructureRegisty.TEST_STRUCTURE, IFeatureConfig.NO_FEATURE_CONFIG); this.setRegistryName(MobWar.location(MobWar.MODID + "diamond_biome")); } } If anyone could give me some guidance, as always, I would appreciate.
  16. Duh. Thanks. So now that I have that fixed I'm having an issue with the render. This is what it occasionally looks like, and how it should look. But then it well look like this with the cut outs rendering black which just doesn't look appealing. Any suggestions on this would be appreciated. Here is my new render code if that helps. @Override public void render(DiamondTreeLeavesTile tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.enableDepthTest(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); GlStateManager.pushMatrix(); GlStateManager.translatef((float)x , (float)y , (float)z); this.bindTexture(TEXTURE); this.setLightmapDisabled(true); this.isGlobalRenderer(tileEntityIn); MODEL.renderThis(); this.setLightmapDisabled(false); GlStateManager.popMatrix(); }
  17. My Goal: I want a block that ignores "light effects". I believe I can accomplish this with a tile entity, but cant fully figure out TileEntityRenderer. So to start with my TileEntityRenderer class: public class TestTileRenderer extends TileEntityRenderer<TestTile> { @Override public void render(TestTile te, double x, double y, double z, float partialTicks, int destroyStage) { this.setLightmapDisabled(true); } } I believe that should disable "light effects", but seems to have no effect. I'm sure it's my lack of understanding that is the problem. But if anyone could point out something that i'm doing wrong I would appreciate it or know of another way of achieving my goal. Maybe I am registering it wrong: @Mod("genericname") public class GenericName { ... public GenericName() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); ... } ... } private void clientRegistries(final FMLCommonSetupEvent event) { ClientRegistry.bindTileEntitySpecialRenderer(TestTile.class, new TestTileRenderer()); }
  18. Where in OP's broken english does he/she say anything about only using it once. The code does exactly what they are asking.
×
×
  • Create New...

Important Information

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