Compare commits

...
7 Commits
Author SHA1 Message Date
Martin Robertz d60fc9b436 update 2024-05-20 11:07:51 +02:00
Martin Robertz 6ad43b2e0d Merge remote-tracking branch 'TheUnderTaker11/git-please' into dev 2024-05-20 11:07:22 +02:00
CreditScore 77f3e6974f Travel Staff Blink Keybind fixes.
Fixes 2 separate bugs with the SoT keybind.
1. Staff of Teleportation in GTNH pack specifically didn't work due to reporting as having 0 power through the RF API. Fixed this by having it always report that it's full of power since it has infinite.
2. BlackSteelSword and EndSteelSword (The Ender and MKII) both were quite funky with keybind, causing no teleports to happen when they really should have.
Fixed this through tweaks to how this is handled in a number of places to allow for proper handling while not changing the default held/shift held behavior.

Tested in SP, Anchor behavior while holding staffs and Swords with travel thing on them work as expected. Keybind now works and is able to use swords with travel thing on them.
One quirk is that if you are holding a sword with travel upgrade, but NOT shifting, the sword itself stops counting as a valid travel item. So if ONLY using sword no separate SoT the keybind will not work unless you hold shift. If you have another SoT in your inventory it will identify and use that and still blink you upon hitting keybind.
This quirk doesn't really matter in most cases, just something worth noting I guess.
2024-05-19 15:13:50 -05:00
Martin Robertz 42573b3fa4 update 2024-05-09 10:04:12 +02:00
Martin Robertz c4cbe05dfe Merge branch 'master' into dev
# Conflicts:
#	dependencies.gradle
2024-05-09 10:03:47 +02:00
Martin Robertz fb4c9bde59 update 2024-05-09 10:02:46 +02:00
Oleg Ivanov bd47a39c83 Add config entries for Farming Station particles (#162)
* Decrease number of Farming Station particles

* Set default values for range & number of particles to original
2024-05-08 20:48:35 +02:00
9 changed files with 92 additions and 33 deletions

No files matched your search

+3 -3
View File
@@ -12,10 +12,10 @@ dependencies {
compileOnly('com.github.GTNewHorizons:waila:1.7.3:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-400-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.46.05:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.46.18:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.14.1-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.15.0-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.11-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
@@ -24,5 +24,5 @@ dependencies {
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha44:api') {transitive = false}
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha50:api') {transitive = false}
}
@@ -397,6 +397,8 @@ public final class Config {
"TwilightForest:item.steeleafHoe", "TwilightForest:item.ironwoodHoe", "IC2:itemToolBronzeHoe" };
public static List<ItemStack> farmHoes = new ArrayList<ItemStack>();
public static int farmSaplingReserveAmount = 8;
public static double farmParticlesMaxRange = 64;
public static int farmParticlesCount = 15;
public static int magnetPowerUsePerSecondRF = 1;
public static int magnetPowerCapacityRF = 100000;
@@ -2127,6 +2129,18 @@ public final class Config {
+ "always shear all leaves.")
.getInt(farmSaplingReserveAmount);
farmParticlesMaxRange = config.get(
sectionFarm.name,
"farmParticlesMaxRange",
farmParticlesMaxRange,
"The max range of the farm action particles.").getDouble(farmParticlesMaxRange);
farmParticlesCount = config.get(
sectionFarm.name,
"farmParticlesCount",
farmParticlesCount,
"The number of particles produces by farm action.").getInt(farmParticlesCount);
combustionGeneratorUseOpaqueModel = config
.get(
sectionAesthetic.name,
@@ -154,7 +154,8 @@ public class KeyTracker {
if (player != null) {
ItemStack travelItem = player.getHeldItem();
if (travelItem == null || travelItem.getItem() == null
|| !(travelItem.getItem() instanceof IItemOfTravel)) {
|| !(travelItem.getItem() instanceof IItemOfTravel)
|| !((IItemOfTravel) travelItem.getItem()).isActive(player, travelItem)) {
travelItem = TravelController.instance.findTravelItemInInventoryOrBaubles(player);
}
@@ -386,7 +386,15 @@ public class ItemDarkSteelSword extends ItemSword
@Override
public boolean isActive(EntityPlayer ep, ItemStack equipped) {
return isTravelUpgradeActive(ep, equipped);
if (ep != null && equipped != null && isTravelUpgradeActive(ep, equipped)) {
// Only "active" if held while sneaking. But still "active" for the purposes of travel keybind if not held
if (isEquipped(ep)) {
return ep.isSneaking();
} else {
return true;
}
}
return false;
}
@Override
@@ -400,12 +408,12 @@ public class ItemDarkSteelSword extends ItemSword
}
private boolean isTravelUpgradeActive(EntityPlayer ep, ItemStack equipped) {
return isEquipped(ep) && ep.isSneaking() && TravelUpgrade.loadFromItem(equipped) != null;
return ep != null && equipped != null && TravelUpgrade.loadFromItem(equipped) != null;
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (isTravelUpgradeActive(player, stack)) {
if (isActive(player, stack)) {
if (world.isRemote) {
if (TravelController.instance.activateTravelAccessable(stack, world, player, TravelSource.STAFF)) {
player.swingItem();
@@ -9,6 +9,7 @@ import com.enderio.core.common.util.BlockCoord;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.config.Config;
import crazypants.util.ClientUtil;
import io.netty.buffer.ByteBuf;
@@ -51,11 +52,7 @@ public class PacketFarmAction implements IMessage, IMessageHandler<PacketFarmAct
@Override
public IMessage onMessage(PacketFarmAction message, MessageContext ctx) {
for (BlockCoord bc : message.coords) {
for (int i = 0; i < 15; i++) {
ClientUtil.spawnFarmParcticles(rand, bc);
}
}
ClientUtil.spawnFarmParticles(rand, message.coords, Config.farmParticlesCount);
return null;
}
}
@@ -458,8 +458,9 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
IHarvestResult harvest = FarmersCommune.instance.harvestBlock(this, bc, block, meta);
if (harvest != null && harvest.getDrops() != null) {
PacketFarmAction pkt = new PacketFarmAction(harvest.getHarvestedBlocks());
PacketHandler.INSTANCE
.sendToAllAround(pkt, new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
PacketHandler.INSTANCE.sendToAllAround(
pkt,
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, Config.farmParticlesMaxRange));
for (EntityItem ei : harvest.getDrops()) {
if (ei != null) {
insertHarvestDrop(ei, bc);
@@ -487,7 +488,12 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
inventory[minFirtSlot] = farmerJoe.inventory.mainInventory[0];
PacketHandler.INSTANCE.sendToAllAround(
new PacketFarmAction(bc),
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
new TargetPoint(
worldObj.provider.dimensionId,
bc.x,
bc.y,
bc.z,
Config.farmParticlesMaxRange));
if (inventory[minFirtSlot] != null && inventory[minFirtSlot].stackSize == 0) {
inventory[minFirtSlot] = null;
}
@@ -116,6 +116,12 @@ public class ItemTeleportStaff extends ItemTravelStaff {
return power;
}
@Override
public int getEnergyStored(ItemStack item) {
// Has infinite energy, always report as being full of energy for any validation-code purposes.
return this.capacity;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) {
@@ -163,7 +163,8 @@ public class TravelController {
case STAFF_BLINK:
if (Config.travelStaffKeybindEnabled) {
if (equippedItem == null || equippedItem.getItem() == null
|| !(equippedItem.getItem() instanceof IItemOfTravel)) {
|| !(equippedItem.getItem() instanceof IItemOfTravel)
|| !((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) {
equippedItem = findTravelItemInInventoryOrBaubles(toTp);
}
}
@@ -643,7 +644,8 @@ public class TravelController {
ItemStack equipped = ep.getCurrentEquippedItem();
if (checkInventoryAndBaubles) {
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)) {
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)
|| !((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) {
equipped = findTravelItemInInventoryOrBaubles(ep);
}
}
@@ -672,7 +674,8 @@ public class TravelController {
ItemStack travelItem = null;
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
ItemStack stack = ep.inventory.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
if (stack != null && stack.getItem() instanceof IItemOfTravel
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
travelItem = stack;
break;
}
@@ -683,7 +686,8 @@ public class TravelController {
if (baubles != null) {
for (int i = 0; i < baubles.getSizeInventory(); i++) {
ItemStack stack = baubles.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
if (stack != null && stack.getItem() instanceof IItemOfTravel
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
travelItem = stack;
break;
}
@@ -707,7 +711,8 @@ public class TravelController {
int travelItemSlot = -1;
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
ItemStack stack = ep.inventory.getStackInSlot(i);
if (stack != null && (stack.getItem() instanceof IItemOfTravel)) {
if (stack != null && stack.getItem() instanceof IItemOfTravel
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
travelItemSlot = i;
break;
}
@@ -718,7 +723,8 @@ public class TravelController {
if (baubles != null) {
for (int i = 0; i < baubles.getSizeInventory(); i++) {
ItemStack stack = baubles.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
if (stack != null && stack.getItem() instanceof IItemOfTravel
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
travelItemSlot = -(i + 2);
break;
}
+33 -12
View File
@@ -1,10 +1,14 @@
package crazypants.util;
import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityPortalFX;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.enderio.core.common.util.BlockCoord;
@@ -47,18 +51,35 @@ public class ClientUtil {
con.readFromNBT(pkt.tc, TileConduitBundle.NBT_VERSION);
}
public static void spawnFarmParcticles(Random rand, BlockCoord bc) {
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
double zOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
Minecraft.getMinecraft().theWorld.spawnParticle(
"portal",
bc.x + xOff,
bc.y + yOff,
bc.z + zOff,
(rand.nextDouble() - 0.5) * 1.5,
-rand.nextDouble(),
(rand.nextDouble() - 0.5) * 1.5);
public static void spawnFarmParticles(Random rand, List<BlockCoord> coords, int particlesCount) {
// 0 = All, 1 = Decreased, 2 = Minimal
int particleSetting = Minecraft.getMinecraft().gameSettings.particleSetting;
if (particleSetting >= 2 /* Minimal */) {
return;
}
int particles = particleSetting == 0 ? particlesCount /* All */
: (particlesCount / 2) /* Decreased */;
World world = Minecraft.getMinecraft().theWorld;
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
for (BlockCoord bc : coords) {
for (int i = 0; i < particles; i++) {
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
double zOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
effectRenderer.addEffect(
new EntityPortalFX(
world,
bc.x + xOff,
bc.y + yOff,
bc.z + zOff,
(rand.nextDouble() - 0.5) * 1.5,
-rand.nextDouble(),
(rand.nextDouble() - 0.5) * 1.5));
}
}
}
public static void setTankNBT(PacketCombustionTank message, int x, int y, int z) {