Skip to content

Commit

Permalink
Fix clam model.
Browse files Browse the repository at this point in the history
  • Loading branch information
noobanidus committed Feb 9, 2022
1 parent e47b168 commit 95acac8
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 129 deletions.
189 changes: 92 additions & 97 deletions src/main/java/mysticmods/mysticalworld/client/model/ClamModel.java
Expand Up @@ -9,132 +9,127 @@
import java.util.Collections;

public class ClamModel extends AgeableModel<ClamEntity> {

public ModelRenderer Bottom;
public ModelRenderer shape1;
public ModelRenderer shape2;
public ModelRenderer shape3;
public ModelRenderer Top;
public ModelRenderer Bottom_side2;
public ModelRenderer shape3_1;
public ModelRenderer shape2_1;
public ModelRenderer shape1_1;
public ModelRenderer shape2;
public ModelRenderer shape1;
public ModelRenderer Bottom_center;
public ModelRenderer Bottom_side1;
public ModelRenderer Bottom_side2;
public ModelRenderer shape2_1;
public ModelRenderer shape3;
public ModelRenderer Bottom_side4;
public ModelRenderer Bottom_center;
public ModelRenderer Top;
public ModelRenderer Bottom_side3;
public ModelRenderer pearl;
public ModelRenderer pearl_1;
public ModelRenderer shape1_2;
public ModelRenderer shape2_2;
public ModelRenderer shape1_1;
public ModelRenderer part22;
public ModelRenderer shape3_2;
public ModelRenderer shape1_3;
public ModelRenderer shape2_2;
public ModelRenderer shape3_3;
public ModelRenderer shape2_3;
public ModelRenderer shape1_3;
public ModelRenderer shape1_2;
public ModelRenderer Bottom_side3;


public ClamModel() {
this.texWidth = 64;
this.texWidth= 64;
this.texHeight = 32;
this.Bottom_side4 = new ModelRenderer(this, 14, 21);
this.Bottom_side4.setPos(0.0F, -0.5F, 0.0F);
this.Bottom_side4.addBox(4.5F, -0.5F, -3.0F, 1.0F, 1.0F, 6.0F, 0.0F, 0.0F, 0.0F);
this.shape1 = new ModelRenderer(this, 2, 20);
this.shape1.setPos(-5.4F, -3.3F, -0.6F);
this.shape1.addBox(0.0F, 0.0F, -4.0F, 1.0F, 3.0F, 9.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape1, 0.05585053689605638F, -0.09075712609713217F, 0.001745329278001762F);
this.shape1_1 = new ModelRenderer(this, 2, 20);
this.shape1_1.setPos(5.4F, -3.3F, -0.6F);
this.shape1_1.addBox(-1.0F, 0.0F, -4.0F, 1.0F, 3.0F, 9.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape1_1, 0.05585053689605638F, 0.09075712609713217F, 0.0F);
this.shape2_2 = new ModelRenderer(this, 1, 19);
this.shape2_2.setPos(-3.0F, -3.3F, -0.6F);
this.shape2_2.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 10.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape2_2, 0.05585053689605638F, -0.05235987755982988F, 0.0F);
this.Bottom = new ModelRenderer(this, 25, 16);
this.Bottom.setPos(0.0F, 20.25F, 0.0F);
this.Bottom.addBox(-5.5F, -3.0F, -4.0F, 11.0F, 2.0F, 8.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(Bottom, 3.0960395494600967F, 0.0F, 0.0F);
this.shape3_1 = new ModelRenderer(this, 0, 18);
this.shape3_1.setPos(1.0F, -3.3F, -0.6F);
this.shape3_1.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 11.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape3_1, 0.05585053689605638F, 0.04363323129985824F, 0.0F);
this.shape1_3 = new ModelRenderer(this, 2, 20);
this.shape1_3.setPos(5.4F, -3.3F, -0.6F);
this.shape1_3.addBox(-1.0F, 0.0F, -4.0F, 1.0F, 3.0F, 9.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape1_3, 0.05585053689605638F, 0.09075712609713217F, 0.0F);
this.Top = new ModelRenderer(this, 25, 15);
this.Top.setPos(0.0F, -0.2F, 0.0F);
this.Top.addBox(-5.5F, -3.0F, 0.0F, 11, 3, 8, 0.0F);
this.Top.addBox(-5.5F, -3.0F, -4.0F, 11.0F, 3.0F, 8.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(Top, -3.141592653589793F, 3.141592653589793F, 0.0F);
this.Bottom_side2 = new ModelRenderer(this, 0, 4);
this.Bottom_side2.setPos(0.0F, -0.5F, 7.0F);
this.Bottom_side2.addBox(-5.5F, -0.5F, 0.0F, 11, 1, 1, 0.0F);
this.shape3_1 = new ModelRenderer(this, 0, 18);
this.shape3_1.setPos(1.0F, -3.3F, -0.6F);
this.shape3_1.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 11, 0.0F);
this.setRotateAngle(shape3_1, 0.05585053606381855F, 0.04363323129985824F, 0.0F);
this.shape3_2 = new ModelRenderer(this, 0, 18);
this.shape3_2.setPos(-1.0F, -3.3F, -0.6F);
this.shape3_2.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 11, 0.0F);
this.setRotateAngle(shape3_2, 0.05585053606381855F, -0.017453292519943295F, 0.0F);
this.Bottom = new ModelRenderer(this, 25, 16);
this.Bottom.setPos(0.0F, 20.25F, 4.5F);

this.Bottom.addBox(-5.5F, -3.0F, 0.0F, 11, 2, 8, 0.0F);
this.setRotateAngle(Bottom, 3.096039560112741F, 0.0F, 0.0F);
this.shape2 = new ModelRenderer(this, 1, 19);
this.shape2.setPos(-3.0F, -3.3F, -0.6F);
this.shape2.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 10, 0.0F);
this.setRotateAngle(shape2, 0.05585053606381855F, -0.05235987755982988F, 0.0F);
this.shape1_3 = new ModelRenderer(this, 2, 20);
this.shape1_3.setPos(5.4F, -3.3F, -0.6F);
this.shape1_3.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 9, 0.0F);
this.setRotateAngle(shape1_3, 0.05585053606381855F, 0.09075712110370514F, 0.0F);
this.shape2_2 = new ModelRenderer(this, 1, 19);
this.shape2_2.setPos(-3.0F, -3.3F, -0.6F);
this.shape2_2.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 10, 0.0F);
this.setRotateAngle(shape2_2, 0.05585053606381855F, -0.05235987755982988F, 0.0F);
this.pearl = new ModelRenderer(this, 0, 26);
this.pearl.setPos(0.0F, 0.8F, 4.0F);
this.pearl.addBox(-0.5F, -0.5F, -0.5F, 1, 1, 1, 0.0F);
this.setRotateAngle(pearl, -0.477696616270848F, 0.0F, -0.0036651914291880917F);
this.shape3_3 = new ModelRenderer(this, 0, 18);
this.shape3_3.setPos(1.0F, -3.3F, -0.6F);
this.shape3_3.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 11, 0.0F);
this.setRotateAngle(shape3_3, 0.05585053606381855F, 0.04363323129985824F, 0.0F);
this.shape1 = new ModelRenderer(this, 2, 20);
this.shape1.setPos(-5.4F, -3.3F, -0.6F);
this.shape1.addBox(0.0F, 0.0F, 0.0F, 1, 3, 9, 0.0F);
this.setRotateAngle(shape1, 0.05585053606381855F, -0.09075712110370514F, 0.0017453292519943296F);
this.shape2.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 10.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape2, 0.05585053689605638F, -0.05235987755982988F, 0.0F);
this.Bottom_side3 = new ModelRenderer(this, 14, 21);
this.Bottom_side3.setPos(0.0F, -0.5F, 0.0F);
this.Bottom_side3.addBox(-5.5F, 0.0F, -3.0F, 1.0F, 1.0F, 6.0F, 0.0F, 0.0F, 0.0F);
this.Bottom_center = new ModelRenderer(this, 0, 10);
this.Bottom_center.setPos(0.0F, -0.4F, 0.0F);
this.Bottom_center.addBox(-4.5F, -0.9F, 1.0F, 9, 1, 6, 0.0F);
this.setRotateAngle(Bottom_center, 0.031415926535897934F, 0.0F, 0.0F);
this.Bottom_side1 = new ModelRenderer(this, 0, 7);
this.Bottom_side1.setPos(0.0F, -0.5F, 0.0F);
this.Bottom_side1.addBox(-5.5F, -0.5F, 0.0F, 11, 1, 1, 0.0F);
this.pearl_1 = new ModelRenderer(this, 0, 26);
this.pearl_1.setPos(0.0F, 0.0F, 0.0F);
this.pearl_1.addBox(-0.5F, -0.5F, -0.5F, 1, 1, 1, 0.0F);
this.setRotateAngle(pearl_1, 0.0F, 0.7853981633974483F, 0.7853981633974483F);
this.Bottom_center.addBox(-4.5F, -0.9F, -3.0F, 9.0F, 1.0F, 6.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(Bottom_center, 0.03141592778425469F, 0.0F, 0.0F);
this.shape1_2 = new ModelRenderer(this, 2, 20);
this.shape1_2.setPos(-5.4F, -3.3F, -0.6F);
this.shape1_2.addBox(0.0F, 0.0F, -4.0F, 1.0F, 3.0F, 9.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape1_2, 0.05585053689605638F, -0.09075712609713217F, 0.001745329278001762F);
this.Bottom_side2 = new ModelRenderer(this, 0, 4);
this.Bottom_side2.setPos(0.0F, -0.5F, 7.0F);
this.Bottom_side2.addBox(-5.5F, -0.5F, -4.0F, 11.0F, 1.0F, 1.0F, 0.0F, 0.0F, 0.0F);
this.shape2_3 = new ModelRenderer(this, 1, 19);
this.shape2_3.setPos(3.0F, -3.3F, -0.6F);
this.shape2_3.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 10, 0.0F);
this.setRotateAngle(shape2_3, 0.05585053606381855F, 0.03490658503988659F, 0.0F);
this.shape2_3.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 10.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape2_3, 0.05585053689605638F, 0.03490658503988659F, 0.0F);
this.shape2_1 = new ModelRenderer(this, 1, 19);
this.shape2_1.setPos(3.0F, -3.3F, -0.6F);
this.shape2_1.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 10, 0.0F);
this.setRotateAngle(shape2_1, 0.05585053606381855F, 0.03490658503988659F, 0.0F);
this.shape2_1.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 10.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape2_1, 0.05585053689605638F, 0.03490658503988659F, 0.0F);
this.shape3 = new ModelRenderer(this, 0, 18);
this.shape3.setPos(-1.0F, -3.3F, -0.6F);
this.shape3.addBox(-0.5F, 0.0F, 0.0F, 1, 3, 11, 0.0F);
this.setRotateAngle(shape3, 0.05585053606381855F, -0.017453292519943295F, 0.0F);
this.Bottom_side3 = new ModelRenderer(this, 14, 21);
this.Bottom_side3.setPos(0.0F, -0.5F, 0.0F);
this.Bottom_side3.addBox(-5.5F, 0.0F, 1.0F, 1, 1, 6, 0.0F);
this.shape1_2 = new ModelRenderer(this, 2, 20);
this.shape1_2.setPos(-5.4F, -3.3F, -0.6F);
this.shape1_2.addBox(0.0F, 0.0F, 0.0F, 1, 3, 9, 0.0F);
this.setRotateAngle(shape1_2, 0.05585053606381855F, -0.09075712110370514F, 0.0017453292519943296F);
this.Bottom_side4 = new ModelRenderer(this, 14, 21);
this.Bottom_side4.setPos(0.0F, -0.5F, 0.0F);
this.Bottom_side4.addBox(4.5F, -0.5F, 1.0F, 1, 1, 6, 0.0F);
this.shape1_1 = new ModelRenderer(this, 2, 20);
this.shape1_1.setPos(5.4F, -3.3F, -0.6F);
this.shape1_1.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 9, 0.0F);
this.setRotateAngle(shape1_1, 0.05585053606381855F, 0.09075712110370514F, 0.0F);
this.Bottom.addChild(this.Top);
this.Bottom.addChild(this.Bottom_side2);
this.shape3.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 11.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape3, 0.05585053689605638F, -0.017453292519943295F, 0.0F);
this.shape3_2 = new ModelRenderer(this, 0, 18);
this.shape3_2.setPos(-1.0F, -3.3F, -0.6F);
this.shape3_2.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 11.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape3_2, 0.05585053689605638F, -0.017453292519943295F, 0.0F);
this.part22 = new ModelRenderer(this, 0, 0);
this.part22.setPos(0.0F, 0.0F, 0.0F);
this.part22.addBox(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, 0.0F, 0.0F);
this.Bottom_side1 = new ModelRenderer(this, 0, 7);
this.Bottom_side1.setPos(0.0F, -0.5F, 0.0F);
this.Bottom_side1.addBox(-5.5F, -0.5F, -4.0F, 11.0F, 1.0F, 1.0F, 0.0F, 0.0F, 0.0F);
this.shape3_3 = new ModelRenderer(this, 0, 18);
this.shape3_3.setPos(1.0F, -3.3F, -0.6F);
this.shape3_3.addBox(-0.5F, 0.0F, -4.0F, 1.0F, 3.0F, 11.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(shape3_3, 0.05585053689605638F, 0.04363323129985824F, 0.0F);
this.Bottom.addChild(this.Bottom_side4);
this.Bottom.addChild(this.shape1);
this.Bottom.addChild(this.shape1_1);
this.Top.addChild(this.shape2_2);
this.Bottom.addChild(this.shape3_1);
this.Top.addChild(this.shape3_2);
this.Bottom.addChild(this.shape2);
this.Top.addChild(this.shape1_3);
this.Top.addChild(this.shape2_2);
this.Bottom_center.addChild(this.pearl);
this.Top.addChild(this.shape3_3);
this.Bottom.addChild(this.shape1);
this.Bottom.addChild(this.Top);
this.Bottom.addChild(this.shape2);
this.Bottom_side4.addChild(this.Bottom_side3);
this.Bottom.addChild(this.Bottom_center);
this.Bottom.addChild(this.Bottom_side1);
this.pearl.addChild(this.pearl_1);
this.Top.addChild(this.shape1_2);
this.Bottom.addChild(this.Bottom_side2);
this.Top.addChild(this.shape2_3);
this.Bottom.addChild(this.shape2_1);
this.Bottom.addChild(this.shape3);
this.Bottom_side4.addChild(this.Bottom_side3);
this.Top.addChild(this.shape1_2);
this.Bottom.addChild(this.Bottom_side4);
this.Bottom.addChild(this.shape1_1);
this.Top.addChild(this.shape3_2);
this.Bottom.addChild(this.part22);
this.Bottom.addChild(this.Bottom_side1);
this.Top.addChild(this.shape3_3);

}

@Override
Expand Down
Expand Up @@ -18,21 +18,14 @@ public ClamRenderer(EntityRendererManager pManager, ClamModel pModel, float pSca

@Override
public ResourceLocation getTextureLocation(ClamEntity pEntity) {
if (pEntity.getEntityData().get(ClamEntity.isEnder)) {
return new ResourceLocation(MysticalWorld.MODID, "textures/entity/ender_clam.png");
} else {
return new ResourceLocation(MysticalWorld.MODID, "textures/entity/clam.png");
}
return new ResourceLocation(MysticalWorld.MODID, "textures/entity/clam.png");
}

public static class Factory implements IRenderFactory<ClamEntity> {

@Override
@Nonnull
public ClamRenderer createRenderFor(@Nonnull EntityRendererManager manager) {
return new ClamRenderer(manager, ModelHolder.clamModel, 0.5f);
}
}


}
9 changes: 4 additions & 5 deletions src/main/java/mysticmods/mysticalworld/entity/ClamEntity.java
Expand Up @@ -166,14 +166,13 @@ protected void saveToBucketTag(ItemStack p_204211_1_) {
p_204211_1_.setHoverName(this.getCustomName());
}

CompoundNBT tag = p_204211_1_.getOrCreateTag();
tag.putBoolean("isEnder", getEntityData().get(isEnder));
tag.putInt("age", getEntityData().get(age));
}

protected ItemStack getBucketItemStack() {
if (getEntityData().get(isEnder)) {
return new ItemStack(ModItems.ENDER_CLAM_BUCKET.get());
} else {
return new ItemStack(ModItems.CLAM_BUCKET.get());
}
return new ItemStack(ModItems.CLAM_BUCKET.get());
}

public static boolean checkClamSpawnRules(EntityType<? extends ClamEntity> p_223363_0_, IWorld p_223363_1_, SpawnReason p_223363_2_, BlockPos p_223363_3_, Random p_223363_4_) {
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/mysticmods/mysticalworld/init/ModItems.java
Expand Up @@ -93,14 +93,10 @@ public class ModItems {
})
.register();

public static RegistryEntry<ClamBucketItem> CLAM_BUCKET = MysticalWorld.REGISTRATE.item("clam_bucket", (p) -> new ClamBucketItem(false, () -> Fluids.WATER, p))
public static RegistryEntry<ClamBucketItem> CLAM_BUCKET = MysticalWorld.REGISTRATE.item("clam_bucket", (p) -> new ClamBucketItem(() -> Fluids.WATER, p))
.properties(o -> o.stacksTo(1))
.register();

public static RegistryEntry<ClamBucketItem> ENDER_CLAM_BUCKET = MysticalWorld.REGISTRATE.item("ender_clam_bucket", (p) -> new ClamBucketItem(true, () -> Fluids.WATER, p))
.properties(o -> o.stacksTo(1).rarity(Rarity.EPIC))
.register();

public static RegistryEntry<AntlerHatItem> ANTLER_HAT = MysticalWorld.REGISTRATE.item("antler_hat", AntlerHatItem::new)
.properties(o -> o.durability(399).rarity(Rarity.RARE))
.recipe((o, p) -> ShapedRecipeBuilder.shaped(o.getEntry(), 1)
Expand Down
22 changes: 8 additions & 14 deletions src/main/java/mysticmods/mysticalworld/items/ClamBucketItem.java
@@ -1,30 +1,27 @@
package mysticmods.mysticalworld.items;

import mysticmods.mysticalworld.entity.ClamEntity;
import mysticmods.mysticalworld.init.ModEntities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.passive.fish.AbstractFishEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import mysticmods.mysticalworld.init.ModEntities;

import javax.annotation.Nullable;

public class ClamBucketItem extends BucketItem {
public final boolean isEnder;

public ClamBucketItem(boolean isEnder, java.util.function.Supplier<? extends Fluid> p_i49022_2_, Item.Properties builder) {
public ClamBucketItem(java.util.function.Supplier<? extends Fluid> p_i49022_2_, Item.Properties builder) {
super(p_i49022_2_, builder);
this.isEnder = isEnder;
}

public void checkExtraContent(World level, ItemStack stack, BlockPos pos) {
Expand All @@ -38,16 +35,13 @@ protected void playEmptySound(@Nullable PlayerEntity pPlayer, IWorld pLevel, Blo
}

private void spawn(ServerWorld level, ItemStack stack, BlockPos pos) {
Entity entity = ModEntities.CLAM.get().spawn(level, stack, (PlayerEntity) null, pos, SpawnReason.BUCKET, true, false);
Entity entity = ModEntities.CLAM.get().spawn(level, stack, null, pos, SpawnReason.BUCKET, true, false);
if (entity != null) {
ClamEntity clam = (ClamEntity) entity;
if (isEnder) {
clam.getEntityData().set(ClamEntity.isEnder, true);
}
CompoundNBT tag = stack.getOrCreateTag();
clam.getEntityData().set(ClamEntity.isEnder, tag.getBoolean("isEnder"));
clam.getEntityData().set(ClamEntity.age, tag.getInt("age"));
clam.setFromBucket(true);
}
if (entity != null) {
((AbstractFishEntity) entity).setFromBucket(true);
}

}
}
Binary file not shown.
Binary file not shown.

0 comments on commit 95acac8

Please sign in to comment.