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


  • Posts

  • Joined

  • Last visited

Everything posted by _HungTeen_

  1. I am making a music disc Item named [Zombie On Your Lawn]. I can correctly use the disc Item to right click JuckBox, and it can play the right music. But When i leave the JuckBox Block for about 200 blocks away, the music is still playing.(normally, when player about 30 blocks away, the music will stop playing). Here is the code in ItemRegister. public static final RegistryObject<Item> ZOMBIE_ON_YOUR_LAWN = ITEMS.register("zombie_on_your_lawn", () -> {return new MusicDiscItem(0, () -> { return SoundRegister.ZOMBIE_ON_YOUR_LAWN.get(); }, new Item.Properties().maxStackSize(1).group(GroupRegister.PVZ_MISC).rarity(Rarity.RARE)); }); "zombie_on_your_lawn":{ "subtitle": "sound.pvz.zombie_on_your_lawn", "sounds":[{"name":"pvz:music/zombie_on_your_lawn", "stream":true}] }
  2. Thx for reply. I try it before, but still the same error. I even copy a trigger code from twilightforest, also failed. Idk if it is because i miss some important register.
  3. I am making a new Criterion trigger called SunAmountTrigger. First I create SunAmountTrigger class like the default did : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/advancement/SunAmountTrigger.java And then I register it in AdvancementHandler : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/advancement/AdvancementHandler.java Here is the json file of the custom advancement : https://github.com/HungTeen/pvzmod/blob/dev/src/main/resources/data/pvz/advancements/sunny_days.json But When I run mc, I didn't see the advancements and got log like this: [m[1;31m[11:11:47] [Server thread/ERROR] [minecraft/AdvancementManager]: Parsing error loading custom advancement pvz:sunny_days: Invalid criterion trigger: minecraft:sun_amount I don't know why it's Invalid, tysm if someone can help me figure out.
  4. You can focus on the defualt code about how to correctly add structure. I will show you default desert_pyramid. one is addStructure this.addStructure(Feature.DESERT_PYRAMID.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); another is addFeature biomeIn.addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Feature.DESERT_PYRAMID.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG))); So what you need to do is add "addFeature" method. I think addStructure means the biome can spawn the structure. addFeature means the biome can show the structure.
  5. Ok,my bad . Its still a small mistake like last time. I forgot to break in switch 😅 Can I delete this topic?
  6. I am making a WorldEventData class to save my world event set. private HashSet<Events> events = new HashSet<>(Events.values().length); When I add event to the set ,it seems ok. public void addEvent(Events ev) { events.add(ev); // System.out.println(events.contains(ev)); this.markDirty(); } If I use code below to check wheather it add correctly,it output nothing (means the event did't add correctly) @SuppressWarnings("resource") @SubscribeEvent public static void onPlayerRightClick(RightClickItem ev){ // System.out.println(ev.getWorld().getDayTime()); if(!ev.getWorld().isRemote) { WorldEventData data = WorldEventData.getOverWorldEventData(ev.getWorld()); for(Events event:Events.values()) { System.out.println(data.hasEvent(event)); } } } Codes which maybe related. WorldEventData : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/world/data/WorldEventData.java RightClickEvent : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/event/PVZPlayerEvent.java#L83 The place I add event : https://github.com/HungTeen/pvzmod/blob/dev/src/main/java/com/hungteen/pvz/event/OverWorldEvent.java#L64
  7. ok,finally i know the problem. Im just so stupid ! public DaveVillaComponent(TemplateManager manager, ResourceLocation res,BlockPos pos, Rotation rotation) { super(IStructurePieceType.SHIPWRECK, 0); this.templatePosition = pos; this.rotation = rotation; this.res=res; // this.midPos=blockpos; this.setUpTemplate(manager); } I just forgot to change the IStrucurePieceType.SHIPWRECK which I copy from default code.
  8. I am making a structure with 4 template pieces . Sometimes it gen properly like this. But mostly,it gen like this. here is the code https://github.com/HungTeen/pvzmod/tree/dev/src/main/java/com/hungteen/pvz/structure/davevilla and this picture maybe helpful.It shows the place of structure block. I have troubled a whole day. hope you guys will help me out. Thanks !
  9. public class EntityConeHead extends MultiPartEntityPart{ private EntityNormalZombie zombie; public EntityConeHead(EntityNormalZombie zombie, String partName, float width, float height) { super(zombie, partName, width, height); this.zombie=zombie; this.setExist(); } @Override public boolean attackEntityFrom(DamageSource source, float amount) { //System.out.println(this.world.isRemote+" "+source.damageType+" "+amount); return super.attackEntityFrom(source, amount); } public void setExist() { if(this.parent instanceof EntityZombieBase) { if(((EntityZombieBase) this.parent).getIsInivs()) this.setInvisible(true); else this.setInvisible(false); } else { System.out.println("error parent!"); return ; } } public EntityZombieBase getZombie() { return this.zombie; } public void setBreak() { this.setSize(0f, 0f); this.setInvisible(true); } } public class EntityConeHeadZombie extends EntityNormalZombie implements IEntityMultiPart{ private final EntityConeHead cone; public EntityConeHeadZombie(World worldIn) { super(worldIn); cone=new EntityConeHead(this, "cone_head", 0.5f, 1f); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(56.0D); } @Override public void onUpdate() { super.onUpdate(); if(this.getHealth()<=20) { this.cone.setBreak(); } else{ this.cone.setLocationAndAngles(this.posX, this.posY+1.5, this.posZ, this.rotationYawHead, -this.rotationPitch); } this.world.updateEntityWithOptionalForce(this.cone, true); } @Override protected boolean canDespawn() { return false; } @Override public void setDead() { super.setDead(); this.cone.setDead(); } @Override public Entity[] getParts() { return new Entity[] {this.cone}; } @Override public World getWorld() { return this.world; } @Override public boolean attackEntityFromPart(MultiPartEntityPart part, DamageSource source, float damage) { return this.attackEntityFrom(source, damage); } @Override public boolean isNonBoss() { return false; } } It's my first time to ask question at here.The problem is I am making a ConeHead Zombie by using multipartEntity ,When my peaShooter kill some ConeHead Zombie,there will exist some invisble object blocking my peaShooter's bullet.I know it may be the uncleared Cone,but I don't know how to deal with it.Pls help me ,thx !
  • Create New...

Important Information

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