• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Try overriding the remove method in the ColoredSlimeEntity and setting the color of the new children to the same color as the parent.
    • I've made an Custom Slime Entity that his color works like Sheep's color. So i have one white slime template and for each slime created i "randomize" it's color. The problem is that when the slime dies, it's childs spawn with the template color and not with the "parent" color. I've already googled around and searched betwen the classes but ended up with nothing, so how can i pass the color to the new little slimes when a big one dies? the Entity code: package net.ddns.samjviana.morethings.entity; import java.util.Arrays; import java.util.Map; import java.util.Random; import java.util.stream.Collectors; import com.google.common.collect.Maps; import net.minecraft.entity.EntitySize; import net.minecraft.entity.EntityType; import net.minecraft.entity.ILivingEntityData; import net.minecraft.entity.Pose; import net.minecraft.entity.SpawnReason; import net.minecraft.entity.ai.attributes.AttributeModifierMap; import net.minecraft.entity.ai.attributes.Attributes; import net.minecraft.entity.monster.SlimeEntity; import net.minecraft.item.DyeColor; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; import net.minecraft.util.math.MathHelper; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.IWorld; import net.minecraft.world.World; public class ColoredSlimeEntity extends SlimeEntity { private static final DataParameter<Byte> DYE_COLOR = EntityDataManager.createKey(SlimeEntity.class, DataSerializers.BYTE); private static final Map<DyeColor, float[]> DYE_TO_RGB = Maps.newEnumMap(Arrays.stream(DyeColor.values()).collect(Collectors.toMap( (DyeColor dyeColor) -> { return dyeColor; }, ColoredSlimeEntity::createSlimeColor))); public ColoredSlimeEntity(final EntityType<? extends ColoredSlimeEntity> entityType, final World world) { super(entityType, world); } @Override protected void setSlimeSize(int size, boolean resetHealth) { super.setSlimeSize(size, resetHealth); } @Override protected boolean spawnCustomParticles() { int i = this.getSlimeSize(); for(int j = 0; j < i * 8; ++j) { float f = this.rand.nextFloat() * ((float)Math.PI * 2F); float f1 = this.rand.nextFloat() * 0.5F + 0.5F; float f2 = MathHelper.sin(f) * (float)i * 0.5F * f1; float f3 = MathHelper.cos(f) * (float)i * 0.5F * f1; this.world.addParticle(this.getSquishParticle(), this.getPosX() + (double)f2, this.getPosY(), this.getPosZ() + (double)f3, 0.0D, 0.0D, 0.0D); } return super.spawnCustomParticles(); } @Override public void onDeath(DamageSource cause) { // TODO Auto-generated method stub super.onDeath(cause); } public static float[] getDyeRgb(DyeColor dyeColor) { return DYE_TO_RGB.get(dyeColor); } private static float[] createSlimeColor(DyeColor dyeColorIn) { if (dyeColorIn == DyeColor.WHITE) { return new float[]{0.9019608F, 0.9019608F, 0.9019608F}; } else { float[] afloat = dyeColorIn.getColorComponentValues(); return new float[]{afloat[0] * 0.75F, afloat[1] * 0.75F, afloat[2] * 0.75F}; } } public static AttributeModifierMap getAttributes() { AttributeModifierMap.MutableAttribute attributes = SlimeEntity.func_233666_p_(); attributes.func_233814_a_(Attributes.field_233823_f_); return attributes.func_233813_a_(); } @Override public ILivingEntityData onInitialSpawn(IWorld worldIn, DifficultyInstance difficultyIn, SpawnReason reason, ILivingEntityData spawnDataIn, CompoundNBT dataTag) { this.setSlimeColor(getRandomSlimeColor(worldIn.getRandom())); return super.onInitialSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); } public void setSlimeColor(DyeColor color) { byte b0 = this.dataManager.get(DYE_COLOR); this.dataManager.set(DYE_COLOR, (byte)(b0 & 240 | color.getId() & 15)); } public static DyeColor getRandomSlimeColor(Random random) { int i = random.nextInt(15); return DyeColor.byId(i); } @Override protected void registerData() { super.registerData(); this.dataManager.register(DYE_COLOR, (byte)0); } public void writeAdditional(CompoundNBT compound) { super.writeAdditional(compound); compound.putByte("Color", (byte)this.getSlimeColor().getId()); } public DyeColor getSlimeColor() { return DyeColor.byId(this.dataManager.get(DYE_COLOR) & 15); } @Override public EntitySize getSize(Pose poseIn) { return super.getSize(poseIn); } @Override public int getSlimeSize() { return super.getSlimeSize(); } }  
    • Once everything you need is in the    "src/main/java" and "src/main/resources"   If you are running with Eclipse   Use the Command Line in the folder where the    gradlew   file is, and run this command:   gradlew build   This will automatically produce the .jar file with your mod inside ready to run
    • So I am updating my mods to 1.14.4 from 1.12. If I put the mod and files into the    src/main/java   Source folder inside eclipse, everything works normally. I have a sub folder (which was created when setting up the 1.14.4 environment) called   src/test/java   If i put the mod inside that folder, it gets ignored and doesn't load into the game   I have multiple mods, so the   mods.toml   Will obviously overwrite and the overwritten mods.toml will not load anyway.
    • I'm kinda new to making mods and I'm not entirely sure how to build the .jar file that goes into the mods folder. If anyone can explain how to do it, that would be greatly appreciated.
  • Topics

  • Who's Online (See full list)