Skip to content

Commit

Permalink
fix jitpack compile
Browse files Browse the repository at this point in the history
internal import not found, lets remove it then
  • Loading branch information
Linguardium committed Apr 15, 2020
1 parent 029a58b commit 10c2876
Show file tree
Hide file tree
Showing 12 changed files with 185 additions and 35 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#Gradle
.gradle/
build/
out/
classes/

#IDEA
.idea/
*.iml
*.ipr
*.iws

#vscode
.settings/
.vscode/
bin/
.classpath
.project

#fabric
run/
villager
25 changes: 0 additions & 25 deletions carlsjr.js

This file was deleted.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn_mappings = 1.15.2+build.15
loader_version = 0.8.2+build.194

#Mod properties
mod_version = 1.1.0
mod_version = 1.1.1
maven_group = mod.linguardium
archives_base_name = tradesmen

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mod/linguardium/tradesmen/TradesmenClient.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mod.linguardium.tradesmen;

import mod.linguardium.tradesmen.entities.InitEntities;
import mod.linguardium.tradesmen.entities.SecretTradesmenRenderer;
import mod.linguardium.tradesmen.entities.TradesmenRenderer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
Expand All @@ -10,5 +11,6 @@ public class TradesmenClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
EntityRendererRegistry.INSTANCE.register(InitEntities.TRADESMEN_ENTITY_TYPE, (entityRenderDispatcher, context) -> new TradesmenRenderer(entityRenderDispatcher));
EntityRendererRegistry.INSTANCE.register(InitEntities.SECRET_TRADESMEN_ENTITY_TYPE, (entityRenderDispatcher, context) -> new SecretTradesmenRenderer(entityRenderDispatcher));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mod.linguardium.tradesmen.api;

import jdk.internal.jline.internal.Nullable;

import mod.linguardium.tradesmen.Tradesmen;
import mod.linguardium.tradesmen.entities.InitEntities;
import mod.linguardium.tradesmen.entities.TradesmenEntity;
Expand Down Expand Up @@ -109,7 +109,12 @@ private boolean spawnRoamingTrader() {
return false;
}

TradesmenEntity traderEntity = (TradesmenEntity) InitEntities.TRADESMEN_ENTITY_TYPE.spawn(this.world, (CompoundTag)null, (Text)null, (PlayerEntity)null, blockPos3, SpawnType.EVENT, false, false);
TradesmenEntity traderEntity=null;
if ((Tradesmen.getConfig().secrets && world.random.nextInt(1000) < 1)) {
traderEntity = (TradesmenEntity) InitEntities.SECRET_TRADESMEN_ENTITY_TYPE.spawn(this.world, (CompoundTag) null, (Text) null, (PlayerEntity) null, blockPos3, SpawnType.EVENT, false, false);
}else {
traderEntity = (TradesmenEntity) InitEntities.TRADESMEN_ENTITY_TYPE.spawn(this.world, (CompoundTag) null, (Text) null, (PlayerEntity) null, blockPos3, SpawnType.EVENT, false, false);
}
if (traderEntity != null) {
traderEntity.setTraderType(allowedTraderTypes.get(world.random.nextInt(allowedTraderTypes.size())));
for (int i=0;i<getTraderById(traderEntity.getTraderType()).animalCount; i++) {
Expand Down Expand Up @@ -139,7 +144,7 @@ private void SpawnAnimal(String AnimalId, TradesmenEntity ownerTrader, int dista
}
}
}
@Nullable

private BlockPos getSpawnableHeight(BlockPos pos, int vDistance) {
for (int y = 0; y < vDistance; y++) {
if (SpawnHelper.canSpawn(SpawnRestriction.Location.ON_GROUND, this.world, pos.add(0,y,0), InitEntities.TRADESMEN_ENTITY_TYPE)) {
Expand All @@ -153,7 +158,7 @@ private BlockPos getSpawnableHeight(BlockPos pos, int vDistance) {
}
return null;
}
@Nullable

private BlockPos getPosDistanceFrom(BlockPos blockPos, int distance) {
BlockPos blockPos2 = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public class ModConfig implements ConfigData {

@ConfigEntry.BoundedDiscrete(max=100,min=1)
public int spawnChance = 25;

public boolean secrets = false;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public class InitEntities {
new Identifier(Tradesmen.MOD_ID, "tradesmen_seller"),
FabricEntityTypeBuilder.create(EntityCategory.MISC, TradesmenEntity::new).size(EntityDimensions.fixed(0.6F, 1.95F)).build()
);
public static final EntityType<TradesmenEntity> SECRET_TRADESMEN_ENTITY_TYPE =
Registry.register(
Registry.ENTITY_TYPE,
new Identifier(Tradesmen.MOD_ID, "tradesmen_seller_secret"),
FabricEntityTypeBuilder.create(EntityCategory.MISC, TradesmenEntity::new).size(EntityDimensions.fixed(0.6F, 1.95F)).build()
);
public static void init() {

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package mod.linguardium.tradesmen.entities;

import com.google.common.collect.ImmutableList;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.CompositeEntityModel;
import net.minecraft.client.render.entity.model.ModelWithHat;
import net.minecraft.client.render.entity.model.ModelWithHead;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.AbstractTraderEntity;
import net.minecraft.util.math.MathHelper;

public class SecretTradesmenEntityModel<T extends Entity> extends CompositeEntityModel<T> implements ModelWithHead, ModelWithHat {
protected ModelPart head=null;
protected ModelPart man_torso=null;
protected ModelPart arms=null;
protected ModelPart torso=null;
private ModelPart rightBackLeg=null;
private ModelPart leftBackLeg=null;
private ModelPart rightFrontLeg=null;
private ModelPart leftFrontLeg=null;
protected ModelPart nose=null;
private ModelPart rightChest=null;
private ModelPart leftChest=null;

public SecretTradesmenEntityModel(float scale) {
this(scale, 128, 64);
}

public SecretTradesmenEntityModel(float scale, int textureWidth, int textureHeight) {
float f = 0.7F;
this.head = (new ModelPart(this)).setTextureSize(textureWidth, textureHeight);
this.head.setPivot(0.0F, -10.0F, -5.0F);
this.head.setTextureOffset(0, 0).addCuboid(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, scale);
this.nose = (new ModelPart(this)).setTextureSize(textureWidth, textureHeight);
this.nose.setPivot(0.0F, -2.0F, 0.0F);
this.nose.setTextureOffset(24, 0).addCuboid(-1.0F, -1.0F, -5.0F, 2.0F, 2.0F, 2.0F, scale);
this.head.addChild(this.nose);
this.man_torso = (new ModelPart(this)).setTextureSize(textureWidth, textureHeight);
this.man_torso.setPivot(0.0F, -7.1F, 15.0F);
// Y = front/back
// Z = Height
// X = Left/right
this.man_torso.setTextureOffset(16, 20).addCuboid(-4.0F, 0.0F, -3.0F, 8.0F, 12.0F, 6.0F, scale);
this.man_torso.pitch=-1.5707964F;
/* this.robe = (new ModelPart(this)).setTextureSize(textureWidth, textureHeight);
this.robe.setPivot(0.0F, 0.0F, 0.0F);
this.robe.setTextureOffset(0, 38).addCuboid(-4.0F, 0.0F, -3.0F, 8.0F, 18.0F, 6.0F, scale + 0.5F);
this.man_torso.addChild(this.robe);*/
this.arms = (new ModelPart(this)).setTextureSize(textureWidth, textureHeight);
this.arms.setTextureOffset(0, 40).addCuboid(-8.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, scale);
this.arms.setTextureOffset(0, 40).addCuboid(4.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, scale, true);
this.arms.setTextureOffset(18, 40).addCuboid(-4.0F, 2.0F, -2.0F, 8.0F, 4.0F, 4.0F, scale);
this.arms.setPivot(0.0F, -7.0F, -6.0F);
this.torso = new ModelPart(this, 79, 0).setTextureSize(textureWidth,textureHeight);
this.torso.addCuboid(-6.0F, -10.0F, -7.0F, 12.0F, 18.0F, 10.0F, f);
this.torso.setPivot(0.0F, 5.0F, 2.0F);
this.torso.pitch=1.5707964F;
this.torso.addChild(man_torso);
this.rightChest = new ModelPart(this, 45, 28).setTextureSize(textureWidth,textureHeight);
this.rightChest.addCuboid(-3.0F, 0.0F, 0.0F, 8.0F, 8.0F, 3.0F, f);
this.rightChest.setPivot(-8.5F, 3.0F, 3.0F);
this.rightChest.yaw = 1.5707964F;
this.leftChest = new ModelPart(this, 45, 41).setTextureSize(textureWidth,textureHeight);
this.leftChest.addCuboid(-3.0F, 0.0F, 0.0F, 8.0F, 8.0F, 3.0F, f);
this.leftChest.setPivot(5.5F, 3.0F, 3.0F);
this.leftChest.yaw = 1.5707964F;
this.rightBackLeg = new ModelPart(this, 79, 29).setTextureSize(textureWidth,textureHeight);
this.rightBackLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 14.0F, 4.0F, f);
this.rightBackLeg.setPivot(-2.5F, 10.0F, 6.0F);
this.leftBackLeg = new ModelPart(this, 79, 29).setTextureSize(textureWidth,textureHeight);
this.leftBackLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 14.0F, 4.0F, f);
this.leftBackLeg.setPivot(2.5F, 10.0F, 6.0F);
this.rightFrontLeg = new ModelPart(this, 79, 29).setTextureSize(textureWidth,textureHeight);
this.rightFrontLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 14.0F, 4.0F, f);
this.rightFrontLeg.setPivot(-2.5F, 10.0F, -4.0F);
this.leftFrontLeg = new ModelPart(this, 79, 29).setTextureSize(textureWidth,textureHeight);
this.leftFrontLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 14.0F, 4.0F, f);
this.leftFrontLeg.setPivot(2.5F, 10.0F, -4.0F);
--this.rightBackLeg.pivotX;
++this.leftBackLeg.pivotX;
--this.rightFrontLeg.pivotX;
++this.leftFrontLeg.pivotX;
--this.rightFrontLeg.pivotZ;
--this.leftFrontLeg.pivotZ;
}

public Iterable<ModelPart> getParts() {
return ImmutableList.of(this.head, this.torso, this.arms, this.rightBackLeg, this.leftBackLeg, this.rightFrontLeg, this.leftFrontLeg, this.rightChest, this.leftChest);
}

public void setAngles(T entity, float limbAngle, float limbDistance, float customAngle, float headYaw, float headPitch) {
boolean stillRollin = false;
if (entity instanceof AbstractTraderEntity) {
stillRollin = ((AbstractTraderEntity)entity).getHeadRollingTimeLeft() > 0;
}

this.head.yaw = headYaw * 0.017453292F;
this.head.pitch = headPitch * 0.017453292F;
if (stillRollin) {
this.head.roll = 0.3F * MathHelper.sin(0.45F * customAngle);
this.head.pitch = 0.4F;
} else {
this.head.roll = 0.0F;
}
this.arms.pitch = -0.75F;
this.rightBackLeg.pitch = MathHelper.cos(limbAngle * 0.6662F) * 1.4F * limbDistance;
this.leftBackLeg.pitch = MathHelper.cos(limbAngle * 0.6662F + 3.1415927F) * 1.4F * limbDistance;
this.rightFrontLeg.pitch = MathHelper.cos(limbAngle * 0.6662F + 3.1415927F) * 1.4F * limbDistance;
this.leftFrontLeg.pitch = MathHelper.cos(limbAngle * 0.6662F) * 1.4F * limbDistance;
this.rightChest.visible = true;
this.leftChest.visible = true;
}

public ModelPart getHead() {
return this.head;
}

public void setHatVisible(boolean visible) {
this.head.visible = visible;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package mod.linguardium.tradesmen.entities;

import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;

public class SecretTradesmenRenderer extends MobEntityRenderer<TradesmenEntity, SecretTradesmenEntityModel<TradesmenEntity>> {

public SecretTradesmenRenderer(EntityRenderDispatcher renderManager) {
super(renderManager, new SecretTradesmenEntityModel<>(0.0F), 0.5F);
//this.addFeature(new TradesmenClothingFeatureRenderer(this));
}

@Override
public Identifier getTexture(TradesmenEntity entity) {
return new Identifier("tradesmen:textures/entity/black_llaman.png");
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mod.linguardium.tradesmen.entities;

import jdk.internal.jline.internal.Nullable;

import mod.linguardium.tradesmen.Tradesmen;
import mod.linguardium.tradesmen.api.TradesmenManager;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -43,7 +43,6 @@ public class TradesmenEntity extends WanderingTraderEntity {
private static final TrackedData<Integer> TRADER_TIER = DataTracker.registerData(TradesmenEntity.class, TrackedDataHandlerRegistry.INTEGER);;
private static final TrackedData<CompoundTag> TRADER_SPAWNED_ANIMAL= DataTracker.registerData(TradesmenEntity.class, TrackedDataHandlerRegistry.TAG_COMPOUND);;
private int despawnDelay;
@Nullable
private BlockPos wanderTarget;

public TradesmenEntity(EntityType<? extends WanderingTraderEntity> entityType, World world) {
Expand Down Expand Up @@ -217,7 +216,7 @@ private void tickDespawnDelay() {

}

@Nullable

private BlockPos getWanderTarget() {
return this.wanderTarget;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/tradesmen/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"text.autoconfig.tradesmen.option.spawnChance": "Chance (in %%) of spawning a trader",
"text.autoconfig.tradesmen.option.disableWanderingTrader": "Disable Vanilla Wandering Trader",
"text.autoconfig.tradesmen.option.disableWanderingTradesmen": "Disable Custom Wandering Tradesmen",
"text.autoconfig.tradesmen.option.despawnAnimals": "Despawn trader animal if leashed"
"text.autoconfig.tradesmen.option.despawnAnimals": "Despawn trader animal if leashed",
"text.autoconfig.tradesmen.option.secrets": "Secrets?"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 10c2876

Please sign in to comment.