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
|
## Changed
|
||||||
* Most loot piles now have configurable loot pools
|
* 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
|
||||||
* Fixed some things not using variable max charge for armor mods, like static pads and DNT nanosuit tooltips
|
* 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 api.hbm.energymk2.IEnergyHandlerMK2;
|
||||||
import cofh.api.energy.IEnergyProvider;
|
import cofh.api.energy.IEnergyProvider;
|
||||||
|
|
||||||
|
@Spaghetti("this sucks ass")
|
||||||
public class ExplosionNukeGeneric {
|
public class ExplosionNukeGeneric {
|
||||||
|
|
||||||
private final static Random random = new Random();
|
private final static Random random = new Random();
|
||||||
|
|||||||
@ -9,9 +9,9 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public interface ICopiable {
|
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) {
|
default String getSettingsSourceID(Either<TileEntity, Block> self) {
|
||||||
Block block = self.isLeft() ? self.left().getBlockType() : self.right();
|
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.handler.HbmKeybinds;
|
||||||
import com.hbm.interfaces.ICopiable;
|
import com.hbm.interfaces.ICopiable;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
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.ChatBuilder;
|
||||||
import com.hbm.util.Either;
|
import com.hbm.util.Either;
|
||||||
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -17,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.StatCollector;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
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("Can copy the settings (filters, fluid ID, etc) of machines");
|
||||||
list.add("Shift right-click to copy, right click to paste");
|
list.add("Shift right-click to copy, right click to paste");
|
||||||
list.add("Ctrl click on pipes to paste settings to multiple pipes");
|
list.add("Ctrl click on pipes to paste settings to multiple pipes");
|
||||||
/*if(stack.stackTagCompound != null) {
|
if(stack.stackTagCompound != null) {
|
||||||
NBTTagCompound nbt = stack.stackTagCompound;
|
NBTTagCompound nbt = stack.stackTagCompound;
|
||||||
if (nbt.hasKey("tileName")){
|
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 {
|
} else {
|
||||||
list.add(EnumChatFormatting.RED + " None ");
|
list.add(EnumChatFormatting.RED + " None ");
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
}
|
||||||
//the translation wont fucking work I swear to allah
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
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;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public interface IFluidCopiable extends ICopiable {
|
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<>();
|
|
||||||
|
|
||||||
for (FluidTank tank : tile.getAllTanks()) {
|
/**
|
||||||
if (!tank.getTankType().hasNoID())
|
* @return First type for the normal paste, second type for the alt paste,
|
||||||
types.add(tank.getTankType().getID());
|
* none if there is no alt paste support
|
||||||
}
|
*/
|
||||||
|
default int[] getFluidIDToCopy() {
|
||||||
|
IFluidUser tile = (IFluidUser) this;
|
||||||
|
ArrayList<Integer> types = new ArrayList<>();
|
||||||
|
|
||||||
return BobMathUtil.intCollectionToArray(types);
|
for(FluidTank tank : tile.getAllTanks()) {
|
||||||
}
|
if(!tank.getTankType().hasNoID())
|
||||||
|
types.add(tank.getTankType().getID());
|
||||||
|
}
|
||||||
|
|
||||||
default FluidTank getTankToPaste(){
|
return BobMathUtil.intCollectionToArray(types);
|
||||||
TileEntity te = (TileEntity) this;
|
}
|
||||||
if (te instanceof IFluidStandardTransceiver) {
|
|
||||||
IFluidStandardTransceiver tile = (IFluidStandardTransceiver) this;
|
|
||||||
return tile.getReceivingTanks() != null ? tile.getReceivingTanks()[0] : null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
default FluidTank getTankToPaste() {
|
||||||
default NBTTagCompound getSettings(World world, int x, int y, int z){
|
TileEntity te = (TileEntity) this;
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
if(te instanceof IFluidStandardTransceiver) {
|
||||||
if(getFluidIDToCopy().length > 0)
|
IFluidStandardTransceiver tile = (IFluidStandardTransceiver) this;
|
||||||
tag.setIntArray("fluidID", getFluidIDToCopy());
|
return tile.getReceivingTanks() != null ? tile.getReceivingTanks()[0] : null;
|
||||||
return tag;
|
}
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
default NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||||
if(getTankToPaste() != null) {
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
int[] ids = nbt.getIntArray("fluidID");
|
if(getFluidIDToCopy().length > 0) tag.setIntArray("fluidID", getFluidIDToCopy());
|
||||||
if(ids.length > 0 && index < ids.length) {
|
return tag;
|
||||||
int id = ids[index];
|
}
|
||||||
getTankToPaste().setTankType(Fluids.fromID(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default String[] infoForDisplay(World world, int x, int y, int z) {
|
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||||
int[] ids = getFluidIDToCopy();
|
if(getTankToPaste() != null) {
|
||||||
String[] names = new String[ids.length];
|
int[] ids = nbt.getIntArray("fluidID");
|
||||||
for (int i = 0; i < ids.length; i++) {
|
if(ids.length > 0 && index < ids.length) {
|
||||||
names[i] = Fluids.fromID(ids[i]).getUnlocalizedName();
|
int id = ids[index];
|
||||||
}
|
getTankToPaste().setTankType(Fluids.fromID(id));
|
||||||
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;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IMetalCopiable extends ICopiable {
|
public interface IMetalCopiable extends ICopiable {
|
||||||
int[] getMatsToCopy();
|
|
||||||
|
|
||||||
@Override
|
int[] getMatsToCopy();
|
||||||
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")
|
@SuppressWarnings("unchecked")
|
||||||
public final class Either<L, R> {
|
public final class Either<L, R> {
|
||||||
|
|
||||||
public static <L, R> Either<L, R> left(L value) {
|
public static <L, R> Either<L, R> left(L value) {
|
||||||
return new Either<>(value, true);
|
return new Either<>(value, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user