Skip to content

Commit

Permalink
Add config option to disable boat seat, fix animal rotation, fix typo…
Browse files Browse the repository at this point in the history
… in config
  • Loading branch information
Roadhog360 committed Jul 10, 2021
1 parent 0d4a045 commit 2f2ac3e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public class ConfigurationHandler {
public static boolean replaceOldBoats;
public static float boatMaxLandSpeed;
public static boolean fullGrassPath;
public static boolean newBoatPassengerSeat;

public static boolean enableNewNetherBricks;
public static boolean enableNetherwartBlock;
Expand Down Expand Up @@ -335,8 +336,9 @@ private void syncConfigs() {
// enableDyeReplacement = cfg.getBoolean("enableDyeReplacement", catFunction, true, "Removes lapis, bone meal, ink sac and cocoa bean's ore dictionary entries as dyes, making the Et Futurum dyes the dyes instead. Disable if this causes weirdisms with modded recipes. (If false both items can be used)");
enableExtraCopper = cfg.getBoolean("enableExtraCopper", catFunction, true, "If true, copper will drop 2-3 and fortune will yield more than normal.");
registerRawItemAsOre = cfg.getBoolean("registerRawItemAsOre", catFunction, true, "Registers raw ores as \"ore____\" in the OreDictionary. Configurable in case it causes crafting issues.");
replaceOldBoats = cfg.getBoolean("replaceOldBoats", catFunction, true, "If true, old boats will be replaced with the new oak boat and the item sprite will also be changned. False means the new and old boat and item for it exists separately, and the new boats will use a wooden shovel in their crafting recipe. If this is enabled, a boat that has an entity in it will not be replaced until the entity gets out.");
replaceOldBoats = cfg.getBoolean("replaceOldBoats", catFunction, true, "If true, old boats will be replaced with the new oak boat and the item sprite will also be changned. False means the new and old boat and item for it exists separately, and the new boats will use a wooden shovel in their crafting recipe. If this is enabled, a boat that has an entity in it will not be replaced until the entity gets out. THIS WILL NOT WORK PROPERLY WITH BETTER BOATS INSTALLED");
boatMaxLandSpeed = cfg.getFloat("boatMaxLandSpeed", catFunction, 0.986F, 0.1F, Float.POSITIVE_INFINITY, "The maximum speed a boat can travel by while on land. This option exists because boats are very very fast when travelling on slippery blocks. Land speed = 0.6, Regular/Packed Ice Speed = 0.98, Packed Ice Speed = 0.986. Anything smaller than 0.6 is really, REALLY slow on land. Any value above 1 is exponential speed growth, and is discouraged. (Quicksoil from Aether Legacy is 1.1) The speed values are just block slipperiness values, and are averaged by the slippery blocks around the bottom of the boat.");
newBoatPassengerSeat = cfg.getBoolean("newBoatPassengerSeat", catFunction, true, "If disabled, only one person can sit in the passenger seat at a time.");
fullGrassPath = cfg.getBoolean("fullGrassPath", catFunction, false, "Set to true if you're having issues with stepping over grass paths. Temporary option until fixes are implemented to 1.7's stepping system.");


Expand Down Expand Up @@ -370,7 +372,7 @@ private void syncConfigs() {
maxMagmaPerCluster = cfg.getInt("maxMagmaPerCluster", catWorld, 33, 0, 64, "Max vein size for magma blocks in a cluster");
maxCopperPerCluster = cfg.getInt("copperClusterSize", catWorld, 14, 0, 64, "Max vein size for copper ore blocks in a cluster");
maxDeepslatePerCluster = cfg.getInt("deepslateClusterSize", catWorld, 64, 0, 128, "If deepslateGenerationMode is set to 1, this value is used to determine how big the clusters are. Otherwise this value is unused.");
deepslateMaxY = cfg.getInt("deepslateMaxY", catWorld, 22, 0, 256, "How high up deelslate and tuff goes. If deepslateGenerationMode is 0, all stone up to this y level (with a scattering effect a few blocks before then) are replaced with deepslate. If it's 1, the patches can generate to that Y level.");
deepslateMaxY = cfg.getInt("deepslateMaxY", catWorld, 22, 0, 256, "How high up deepslate and tuff goes. If deepslateGenerationMode is 0, all stone up to this y level (with a scattering effect a few blocks before then) are replaced with deepslate. If it's 1, the patches can generate to that Y level.");
deepslateReplacesStones = cfg.getBoolean("deepslateReplacesStones", catWorld, true, "Whether or not Deepslate will overwrite granite, diorite, andesite (Only works when deepslate generation mode is set to 0)");
deepslateReplacesDirt = cfg.getBoolean("deepslateReplacesDirt", catWorld, true, "Whether or not Deepslate will overwrite dirt (Only works when deepslate generation mode is set to 0)");
deepslateGenerationMode = cfg.getInt("deepslateGenerationMode", catWorld, 0, -1, 1, "If 0, deepslate replaces all stone below the specified value. If 1, it generates in clusters using the above cluster settings. -1 disables deepslate generation entirely");
Expand Down
32 changes: 14 additions & 18 deletions src/main/java/ganymedes01/etfuturum/entities/EntityNewBoat.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public void applyEntityCollision(Entity entityIn)
super.applyEntityCollision(entityIn);
}
}
if (entityIn instanceof EntityNewBoatSeat || getPassengers().contains(entityIn))
if (entityIn instanceof EntityNewBoatSeat || getPassengers().contains(entityIn) || entityIn.ridingEntity instanceof EntityNewBoat || entityIn.ridingEntity instanceof EntityNewBoatSeat)
return;
else if (entityIn.boundingBox.minY <= this.boundingBox.minY)
{
Expand Down Expand Up @@ -388,7 +388,7 @@ public void onEntityUpdate() {
//TODO add option for no passenger seat and don't run this code

//This causes the boat to not fall for some reason!
if(!worldObj.isRemote && !hasSeat()) {
if(!worldObj.isRemote && !hasSeat() && ConfigurationHandler.newBoatPassengerSeat) {
EntityNewBoatSeat newSeat;
if(seatToSpawn == null) {
newSeat = new EntityNewBoatSeat(worldObj, this);
Expand Down Expand Up @@ -931,31 +931,27 @@ public void updatePassenger(Entity passenger)
passenger.setPosition(this.posX + vec3d.xCoord, this.posY + (double)f1, this.posZ + vec3d.zCoord);
passenger.rotationYaw += this.deltaRotation;
this.applyYawToEntity(passenger);
if (passenger instanceof EntityAnimal && this.getPassengers().size() > 1)
{
int j = passenger.getEntityId() % 2 == 0 ? 90 : 270;
((EntityAnimal)passenger).renderYawOffset = ((EntityAnimal)passenger).renderYawOffset + (float)j;
passenger.setRotationYawHead(passenger.getRotationYawHead() + (float)j);
}
}

/**
* Applies this boat's yaw to the given entity. Used to update the orientation of its passenger.
*/
protected void applyYawToEntity(Entity entityToUpdate)
{
float f = MathHelper.wrapAngleTo180_float(entityToUpdate.rotationYaw - this.rotationYaw);
float f1 = MathHelper.clamp_float(f, -105.0F, 105.0F);
int j = 0;
if (entityToUpdate instanceof EntityAnimal && this.getPassengers().size() > 1) {
j = entityToUpdate.getEntityId() % 2 == 0 ? 90 : 270;
}
float f = MathHelper.wrapAngleTo180_float(((EntityLivingBase)entityToUpdate).rotationYawHead - this.rotationYaw) + j;
float f1 = MathHelper.clamp_float(f, -105.0F + j, 105.0F + j % 360);
entityToUpdate.prevRotationYaw += f1 - f;
entityToUpdate.rotationYaw += f1 - f;
if(entityToUpdate instanceof EntityLivingBase) {
f = MathHelper.wrapAngleTo180_float(((EntityLivingBase)entityToUpdate).rotationYawHead - this.rotationYaw);
f1 = MathHelper.clamp_float(f, -105.0F, 105.0F);
if (entityToUpdate instanceof EntityLivingBase) {
((EntityLivingBase)entityToUpdate).rotationYawHead += f1 - f;
((EntityLivingBase)entityToUpdate).prevRotationYawHead += f1 - f;
((EntityLivingBase)entityToUpdate).renderYawOffset = this.rotationYaw;
((EntityLivingBase)entityToUpdate).prevRenderYawOffset = this.rotationYaw;
}
((EntityLivingBase)entityToUpdate).renderYawOffset = this.rotationYaw + j;
((EntityLivingBase)entityToUpdate).prevRenderYawOffset = this.rotationYaw + j;
}
}

/**
Expand All @@ -968,7 +964,7 @@ protected void readEntityFromNBT(NBTTagCompound compound)
this.setBoatType(EntityNewBoat.Type.getTypeFromString(compound.getString("Type")));
}

if(compound.hasKey("Seat") && !worldObj.isRemote) { //TODO add seat config
if(compound.hasKey("Seat") && !worldObj.isRemote && ConfigurationHandler.newBoatPassengerSeat) { //TODO add seat config
Entity entity = EntityList.createEntityFromNBT(compound.getCompoundTag("Seat"), worldObj);
if(entity instanceof EntityNewBoatSeat && entity.riddenByEntity == null) {
((EntityNewBoatSeat)entity).setBoat(this);
Expand All @@ -984,7 +980,7 @@ protected void readEntityFromNBT(NBTTagCompound compound)
protected void writeEntityToNBT(NBTTagCompound compound)
{
compound.setString("Type", this.getBoatType().getName());
if(hasSeat()) {
if(hasSeat() && ConfigurationHandler.newBoatPassengerSeat) {
String s = EntityList.getEntityString(seat);
NBTTagCompound seatData = new NBTTagCompound();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.configuration.ConfigurationHandler;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
Expand Down Expand Up @@ -58,7 +59,7 @@ public void sitEntity(Entity entity) {
@Override
public void onUpdate() {

if(isDead || !worldObj.getChunkFromBlockCoords((int)posX, (int)posZ).isChunkLoaded) {
if(isDead || !worldObj.getChunkFromBlockCoords((int)posX, (int)posZ).isChunkLoaded || !ConfigurationHandler.newBoatPassengerSeat) {
return;
}

Expand Down

0 comments on commit 2f2ac3e

Please sign in to comment.