diff options
author | Blood-Asp <bloodasphendrik@gmail.com> | 2017-11-25 22:41:41 +0100 |
---|---|---|
committer | Dream-Master <dream-master@gmx.net> | 2017-11-28 19:02:25 +0100 |
commit | a3cf54ad0389d54651f8458d2ee3c8e55acbe58f (patch) | |
tree | d76718d551d9204501a84a96abc6f0f169c384a1 | |
parent | 05dbd0487328e71cd5278c3f621c94afe97ea854 (diff) | |
download | GT5-Unofficial-a3cf54ad0389d54651f8458d2ee3c8e55acbe58f.tar.gz GT5-Unofficial-a3cf54ad0389d54651f8458d2ee3c8e55acbe58f.tar.bz2 GT5-Unofficial-a3cf54ad0389d54651f8458d2ee3c8e55acbe58f.zip |
cherry pick
Commit: b96180ac4f1564bcb7a2e19d16738cfea7fc04a3 [b96180a]
GT6 style concrete speedup (no soulsand like behavior that blocks you from entrances and less OP ice hyperspeed highways)
-rw-r--r-- | src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java | 8 | ||||
-rw-r--r-- | src/main/java/gregtech/common/GT_Proxy.java | 16 | ||||
-rw-r--r-- | src/main/java/gregtech/common/blocks/GT_Block_Concretes.java | 15 |
3 files changed, 35 insertions, 4 deletions
diff --git a/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java b/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java new file mode 100644 index 0000000000..a2e7858fbd --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java @@ -0,0 +1,8 @@ +package gregtech.api.interfaces; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.world.World; + +public interface IBlockOnWalkOver { + public void onWalkOver(EntityLivingBase aEntity, World aWorld, int aX, int aY, int aZ); +}
\ No newline at end of file diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 3341721cc2..6130be6af7 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -11,6 +11,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API;
import gregtech.api.enums.*;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
+import gregtech.api.interfaces.IBlockOnWalkOver;
import gregtech.api.interfaces.IProjectileItem;
import gregtech.api.interfaces.internal.IGT_Mod;
import gregtech.api.interfaces.internal.IThaumcraftCompat;
@@ -25,6 +26,7 @@ import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gregtech.common.items.armor.ModularArmor_Item;
import gregtech.common.items.armor.gui.*;
+import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
@@ -45,6 +47,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
+import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
@@ -53,6 +56,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
+import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
@@ -1188,6 +1192,15 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { e.printStackTrace(GT_Log.err);
}
}
+
+ @SubscribeEvent
+ public void onLivingUpdate(LivingUpdateEvent aEvent) {
+ if (aEvent.entityLiving.onGround) {
+ int tX = MathHelper.floor_double(aEvent.entityLiving.posX), tY = MathHelper.floor_double(aEvent.entityLiving.boundingBox.minY-0.001F), tZ = MathHelper.floor_double(aEvent.entityLiving.posZ);
+ Block tBlock = aEvent.entityLiving.worldObj.getBlock(tX, tY, tZ);
+ if (tBlock instanceof IBlockOnWalkOver) ((IBlockOnWalkOver)tBlock).onWalkOver(aEvent.entityLiving, aEvent.entityLiving.worldObj, tX, tY, tZ);
+ }
+ }
@SubscribeEvent
public void onFluidContainerRegistration(FluidContainerRegistry.FluidContainerRegisterEvent aFluidEvent) {
@@ -1263,7 +1276,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { aEvent.player.setGameType(GameType.ADVENTURE);
aEvent.player.capabilities.allowEdit = false;
if (this.mAxeWhenAdventure) {
- GT_Utility.sendChatToPlayer(aEvent.player, "It's dangerous to go alone! Take this.");
+ GT_Utility.sendChatToPlayer(aEvent.player, GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_097", "It's dangerous to go alone! Take this.", false));
aEvent.player.worldObj.spawnEntityInWorld(new EntityItem(aEvent.player.worldObj, aEvent.player.posX, aEvent.player.posY,
aEvent.player.posZ, GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.AXE, 1, Materials.Flint, Materials.Wood, null)));
}
@@ -1790,7 +1803,6 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { return new int[]{LOADED,0,-1,-1};
}
-
@SubscribeEvent
public void handleChunkSaveEvent(ChunkDataEvent.Save event) {//ALWAYS SAVE FROM THE HASH MAP DATA
HashMap<ChunkCoordIntPair,int []> chunkData=dimensionWiseChunkData.get(event.world.provider.dimensionId);
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java index 6f3f80c7df..402f50a484 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java @@ -2,6 +2,7 @@ package gregtech.common.blocks; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.IBlockOnWalkOver; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; import net.minecraft.block.Block; @@ -16,11 +17,11 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidBlock; public class GT_Block_Concretes - extends GT_Block_Stones_Abstract { + extends GT_Block_Stones_Abstract implements IBlockOnWalkOver{ public GT_Block_Concretes() { super(GT_Item_Concretes.class, "gt.blockconcretes"); setResistance(20.0F); - this.slipperiness = 0.9F; + //this.slipperiness = 0.9F; GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Dark Concrete"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Dark Concrete Cobblestone"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mossy Dark Concrete Cobblestone"); @@ -70,6 +71,15 @@ public class GT_Block_Concretes return gregtech.api.enums.Textures.BlockIcons.CONCRETES[0].getIcon(); } + @Override + public void onWalkOver(EntityLivingBase aEntity, World aWorld, int aX, int aY, int aZ) { + if ((aEntity.motionX != 0 || aEntity.motionZ != 0) && !aEntity.isInWater() && !aEntity.isWet() && !aEntity.isSneaking()) { + double tSpeed = (aWorld.getBlock(aX, aY-1, aZ).slipperiness >= 0.8 ? 1.5 : 1.2); + aEntity.motionX *= tSpeed; aEntity.motionZ *= tSpeed; + } + } + + /** public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { Block tBlock = aWorld.getBlock(aX, aY + 1, aZ); if (((aEntity instanceof EntityLivingBase)) && (!(tBlock instanceof IFluidBlock)) && (!(tBlock instanceof BlockLiquid)) && (aEntity.onGround) && (!aEntity.isInWater()) && (!aEntity.isWet())) { @@ -92,4 +102,5 @@ public class GT_Block_Concretes } return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 0.875D, aZ + 1); } + **/ } |