mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
cleanup
This commit is contained in:
parent
f806dee99f
commit
2a81e2c5a7
@ -1,5 +1,12 @@
|
||||
## Added
|
||||
* Settings tool
|
||||
* Allows settings of blocks and machines to be copied
|
||||
* Uses settings such as conveyor item filters, fluid types and liquid metal types
|
||||
|
||||
## Changed
|
||||
* Most loot piles now have configurable loot pools
|
||||
* The ntmsatellites command now has the "list" parameter which shows all active satellites in orbit
|
||||
* Burning in the nether in 528 mode now has a config option, and it no longer affects NPCs
|
||||
|
||||
## Fixed
|
||||
* Fixed some things not using variable max charge for armor mods, like static pads and DNT nanosuit tooltips
|
||||
|
||||
@ -34,6 +34,7 @@ import com.hbm.util.ArmorUtil;
|
||||
import api.hbm.energymk2.IEnergyHandlerMK2;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
|
||||
@Spaghetti("this sucks ass")
|
||||
public class ExplosionNukeGeneric {
|
||||
|
||||
private final static Random random = new Random();
|
||||
|
||||
@ -9,9 +9,9 @@ import net.minecraft.world.World;
|
||||
|
||||
public interface ICopiable {
|
||||
|
||||
NBTTagCompound getSettings(World world, int x, int y, int z);
|
||||
NBTTagCompound getSettings(World world, int x, int y, int z);
|
||||
|
||||
void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z);
|
||||
void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z);
|
||||
|
||||
default String getSettingsSourceID(Either<TileEntity, Block> self) {
|
||||
Block block = self.isLeft() ? self.left().getBlockType() : self.right();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,9 +4,11 @@ import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.HbmKeybinds;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.PlayerInformPacket;
|
||||
import com.hbm.packet.toclient.PlayerInformPacket;
|
||||
import com.hbm.util.ChatBuilder;
|
||||
import com.hbm.util.Either;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -17,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -66,16 +67,15 @@ public class ItemSettingsTool extends Item {
|
||||
list.add("Can copy the settings (filters, fluid ID, etc) of machines");
|
||||
list.add("Shift right-click to copy, right click to paste");
|
||||
list.add("Ctrl click on pipes to paste settings to multiple pipes");
|
||||
/*if(stack.stackTagCompound != null) {
|
||||
if(stack.stackTagCompound != null) {
|
||||
NBTTagCompound nbt = stack.stackTagCompound;
|
||||
if (nbt.hasKey("tileName")){
|
||||
list.add(ChatBuilder.startTranslation(nbt.getString("tileName")).color(EnumChatFormatting.BLUE).flush().getFormattedText());
|
||||
list.add(EnumChatFormatting.BLUE + I18nUtil.resolveKey(nbt.getString("tileName") + ".name"));
|
||||
} else {
|
||||
list.add(EnumChatFormatting.RED + " None ");
|
||||
}
|
||||
|
||||
}*/
|
||||
//the translation wont fucking work I swear to allah
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
||||
|
||||
@ -14,56 +14,57 @@ import net.minecraft.world.World;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface IFluidCopiable extends ICopiable {
|
||||
/**
|
||||
* @return First type for the normal paste, second type for the alt paste, none if there is no alt paste support
|
||||
*/
|
||||
default int[] getFluidIDToCopy(){
|
||||
IFluidUser tile = (IFluidUser) this;
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* @return First type for the normal paste, second type for the alt paste,
|
||||
* none if there is no alt paste support
|
||||
*/
|
||||
default int[] getFluidIDToCopy() {
|
||||
IFluidUser tile = (IFluidUser) this;
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
|
||||
for (FluidTank tank : tile.getAllTanks()) {
|
||||
if (!tank.getTankType().hasNoID())
|
||||
types.add(tank.getTankType().getID());
|
||||
}
|
||||
for(FluidTank tank : tile.getAllTanks()) {
|
||||
if(!tank.getTankType().hasNoID())
|
||||
types.add(tank.getTankType().getID());
|
||||
}
|
||||
|
||||
return BobMathUtil.intCollectionToArray(types);
|
||||
}
|
||||
return BobMathUtil.intCollectionToArray(types);
|
||||
}
|
||||
|
||||
default FluidTank getTankToPaste(){
|
||||
TileEntity te = (TileEntity) this;
|
||||
if (te instanceof IFluidStandardTransceiver) {
|
||||
IFluidStandardTransceiver tile = (IFluidStandardTransceiver) this;
|
||||
return tile.getReceivingTanks() != null ? tile.getReceivingTanks()[0] : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
default FluidTank getTankToPaste() {
|
||||
TileEntity te = (TileEntity) this;
|
||||
if(te instanceof IFluidStandardTransceiver) {
|
||||
IFluidStandardTransceiver tile = (IFluidStandardTransceiver) this;
|
||||
return tile.getReceivingTanks() != null ? tile.getReceivingTanks()[0] : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
default NBTTagCompound getSettings(World world, int x, int y, int z){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
if(getFluidIDToCopy().length > 0)
|
||||
tag.setIntArray("fluidID", getFluidIDToCopy());
|
||||
return tag;
|
||||
}
|
||||
@Override
|
||||
default NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
if(getFluidIDToCopy().length > 0) tag.setIntArray("fluidID", getFluidIDToCopy());
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if(getTankToPaste() != null) {
|
||||
int[] ids = nbt.getIntArray("fluidID");
|
||||
if(ids.length > 0 && index < ids.length) {
|
||||
int id = ids[index];
|
||||
getTankToPaste().setTankType(Fluids.fromID(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if(getTankToPaste() != null) {
|
||||
int[] ids = nbt.getIntArray("fluidID");
|
||||
if(ids.length > 0 && index < ids.length) {
|
||||
int id = ids[index];
|
||||
getTankToPaste().setTankType(Fluids.fromID(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
default String[] infoForDisplay(World world, int x, int y, int z) {
|
||||
int[] ids = getFluidIDToCopy();
|
||||
String[] names = new String[ids.length];
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
names[i] = Fluids.fromID(ids[i]).getUnlocalizedName();
|
||||
}
|
||||
return names;
|
||||
}
|
||||
@Override
|
||||
default String[] infoForDisplay(World world, int x, int y, int z) {
|
||||
int[] ids = getFluidIDToCopy();
|
||||
String[] names = new String[ids.length];
|
||||
for(int i = 0; i < ids.length; i++) {
|
||||
names[i] = Fluids.fromID(ids[i]).getUnlocalizedName();
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,26 +7,24 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IMetalCopiable extends ICopiable {
|
||||
int[] getMatsToCopy();
|
||||
|
||||
int[] getMatsToCopy();
|
||||
|
||||
@Override
|
||||
default NBTTagCompound getSettings(World world, int x, int y, int z){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
if(getMatsToCopy().length > 0)
|
||||
tag.setIntArray("matFilter", getMatsToCopy());
|
||||
return tag;
|
||||
}
|
||||
@Override
|
||||
default String[] infoForDisplay(World world, int x, int y, int z) {
|
||||
int[] ids = getMatsToCopy();
|
||||
String[] names = new String[ids.length];
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
names[i] = Mats.matById.get(ids[i]).getUnlocalizedName();
|
||||
}
|
||||
return names;
|
||||
}
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z){
|
||||
@Override
|
||||
default NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
if(getMatsToCopy().length > 0) tag.setIntArray("matFilter", getMatsToCopy());
|
||||
return tag;
|
||||
}
|
||||
|
||||
};
|
||||
@Override
|
||||
default String[] infoForDisplay(World world, int x, int y, int z) {
|
||||
int[] ids = getMatsToCopy();
|
||||
String[] names = new String[ids.length];
|
||||
for(int i = 0; i < ids.length; i++) names[i] = Mats.matById.get(ids[i]).getUnlocalizedName();
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) { };
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import java.util.function.Function;
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class Either<L, R> {
|
||||
|
||||
public static <L, R> Either<L, R> left(L value) {
|
||||
return new Either<>(value, true);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user