Some random fixes, 959 errors

This commit is contained in:
modmuss50 2019-02-21 18:11:55 +00:00
parent 0975b4353b
commit f6a79ce579
37 changed files with 131 additions and 186 deletions

View file

@ -34,7 +34,6 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import org.apache.logging.log4j.LogManager;
@ -43,12 +42,10 @@ import reborncore.RebornCore;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.multiblock.MultiblockEventHandler;
import reborncore.common.multiblock.MultiblockServerTickHandler;
import reborncore.common.network.RegisterPacketEvent;
import reborncore.common.util.StringUtils;
import reborncore.common.util.Torus;
import techreborn.api.TechRebornAPI;
import techreborn.client.GuiHandler;
import techreborn.command.TechRebornDevCommand;
import techreborn.config.ConfigTechReborn;
import techreborn.entities.EntityNukePrimed;
import techreborn.events.BlockBreakHandler;
@ -96,10 +93,6 @@ public class TechReborn {
public TechReborn() {
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void preinit(FMLPreInitializationEvent event) throws IllegalAccessException, InstantiationException {
INSTANCE = this;
@ -109,18 +102,15 @@ public class TechReborn {
//CommonProxy.isChiselAround = Loader.isModLoaded("ctm");
TechRebornAPI.subItemRetriever = new SubItemRetriever();
// Registration
// Registration
TRTileEntities.init();
ModFluids.init();
// Entitys
//EntityRegistry.registerModEntity(new ResourceLocation("techreborn", "nuke"), EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
//EntityRegistry.registerModEntity(new ResourceLocation("techreborn", "nuke"), EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
proxy.preInit(event);
}
@SubscribeEvent
public void init(FMLInitializationEvent event) {
// Registers Chest Loot
ModLoot.init();
MinecraftForge.EVENT_BUS.register(new ModLoot());
@ -157,8 +147,10 @@ public class TechReborn {
Torus.genSizeMap(TileFusionControlComputer.maxCoilSize);
}
@SubscribeEvent
public void postinit(FMLPostInitializationEvent event) {
public void postinit() {
proxy.postInit(event);
ModRecipes.postInit();
@ -202,23 +194,4 @@ public class TechReborn {
// }
}
@SubscribeEvent
public void serverStarting(FMLServerStartingEvent event) {
//event.registerServerCommand(new TechRebornDevCommand());
}
@SubscribeEvent
public void LoadPackets(RegisterPacketEvent event) {
// event.registerPacket(PacketAesu.class, Side.SERVER);
// event.registerPacket(PacketIdsu.class, Side.SERVER);
// event.registerPacket(PacketRollingMachineLock.class, Side.SERVER);
// event.registerPacket(PacketFusionControlSize.class, Side.SERVER);
// event.registerPacket(PacketAutoCraftingTableLock.class, Side.SERVER);
}
@SubscribeEvent
public void onFingerprintViolation(FMLFingerprintViolationEvent event) {
LOGGER.warn("Invalid fingerprint detected for Tech Reborn!");
RebornCore.proxy.invalidFingerprints.add("Invalid fingerprint detected for Tech Reborn!");
}
}

View file

@ -28,6 +28,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.AbstractProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@ -42,6 +43,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.energy.CapabilityEnergy;
@ -90,7 +92,7 @@ public class BlockCable extends BlockContainer {
}
//see for more info https://www.reddit.com/r/feedthebeast/comments/5mxwq9/psa_mod_devs_do_you_call_worldgettileentity_from/
public TileEntity getTileEntitySafely(IBlockAccess blockAccess, BlockPos pos) {
public TileEntity getTileEntitySafely(IWorld blockAccess, BlockPos pos) {
if (blockAccess instanceof ChunkCache) {
return ((ChunkCache) blockAccess).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
} else {
@ -98,7 +100,7 @@ public class BlockCable extends BlockContainer {
}
}
public IProperty<Boolean> getProperty(EnumFacing facing) {
public AbstractProperty<Boolean> getProperty(EnumFacing facing) {
switch (facing) {
case EAST:
return EAST;
@ -201,12 +203,12 @@ public class BlockCable extends BlockContainer {
minSize = 0.35F;
maxSize = 0.65F;
}
float minX = state.getValue(WEST) ? 0.0F : minSize;
float minY = state.getValue(DOWN) ? 0.0F : minSize;
float minZ = state.getValue(NORTH) ? 0.0F : minSize;
float maxX = state.getValue(EAST) ? 1.0F : maxSize;
float maxY = state.getValue(UP) ? 1.0F : maxSize;
float maxZ = state.getValue(SOUTH) ? 1.0F : maxSize;
float minX = state.get(WEST) ? 0.0F : minSize;
float minY = state.get(DOWN) ? 0.0F : minSize;
float minZ = state.get(NORTH) ? 0.0F : minSize;
float maxX = state.get(EAST) ? 1.0F : maxSize;
float maxY = state.get(UP) ? 1.0F : maxSize;
float maxZ = state.get(SOUTH) ? 1.0F : maxSize;
return new AxisAlignedBB((double) minX, (double) minY, (double) minZ, (double) maxX, (double) maxY, (double) maxZ);
}

View file

@ -1,40 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client;
import reborncore.common.config.ConfigGuiFactory;
import techreborn.TechReborn;
public class TechRebornGuiFactory extends ConfigGuiFactory {
@Override
public String getModID() {
return TechReborn.MOD_ID;
}
@Override
public String getModName() {
return TechReborn.MOD_NAME;
}
}

View file

@ -50,18 +50,18 @@ public class ContainerDestructoPack extends RebornContainer {
}
private void buildContainer() {
this.addSlotToContainer(
this.addSlot(
new SlotFilteredVoid(inv, 0, 80, 36, new ItemStack[] { TRContent.Parts.MACHINE_PARTS.getStack() }));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
this.addSlot(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
this.addSlot(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -28,12 +28,12 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

View file

@ -26,9 +26,9 @@ package techreborn.client.render;
import com.google.common.base.Charsets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ModelBlock;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ModelBlock;
import net.minecraft.resources.IResource;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

View file

@ -50,32 +50,32 @@ public class RenderNukePrimed extends Render<EntityNukePrimed> {
public void doRender(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) {
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
GlStateManager.translatef((float) x, (float) y + 0.5F, (float) z);
if ((float) entity.getFuse() - partialTicks + 1.0F < 10.0F) {
float f = 1.0F - ((float) entity.getFuse() - partialTicks + 1.0F) / 10.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
f = f * f;
f = f * f;
float f1 = 1.0F + f * 0.3F;
GlStateManager.scale(f1, f1, f1);
GlStateManager.scalef(f1, f1, f1);
}
this.bindEntityTexture(entity);
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
GlStateManager.translatef(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(TRContent.NUKE.getDefaultState(),
entity.getBrightness());
GlStateManager.translate(0.0F, 0.0F, 1.0F);
GlStateManager.translatef(0.0F, 0.0F, 1.0F);
if (entity.getFuse() / 5 % 2 == 0) {
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 772);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.polygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(
TRContent.NUKE.getDefaultState().with(BlockNuke.OVERLAY, true), 1.0F);
GlStateManager.doPolygonOffset(0.0F, 0.0F);
GlStateManager.polygonOffset(0.0F, 0.0F);
GlStateManager.disablePolygonOffset();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}

View file

@ -36,6 +36,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import reborncore.api.IListInfoProvider;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.RebornCoreConfig;

View file

@ -83,8 +83,8 @@ public class TileAlarm extends TileEntity
// ITickable
@Override
public void update() {
if (!world.isRemote && world.getTotalWorldTime() % 25 == 0 && world.isBlockPowered(getPos())) {
public void tick() {
if (!world.isRemote && world.getGameTime() % 25 == 0 && world.isBlockPowered(getPos())) {
BlockAlarm.setActive(true, world, pos);
switch (selectedSound) {
case 1:
@ -98,7 +98,7 @@ public class TileAlarm extends TileEntity
break;
}
} else if (!world.isRemote && world.getTotalWorldTime() % 25 == 0) {
} else if (!world.isRemote && world.getGameTime() % 25 == 0) {
BlockAlarm.setActive(false, world, pos);
}
}

View file

@ -59,8 +59,8 @@ public class TileChargeOMat extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if(world.isRemote){
return;

View file

@ -44,13 +44,13 @@ public class TileEntityFlare extends TileEntity implements ITickable {
@Override
public void update() {
EnumDyeColor color = world.getBlockState(pos).getValue(BlockFlare.COLOR);
EnumDyeColor color = world.getBlockState(pos).get(BlockFlare.COLOR);
if (world.isRemote && world.isAirBlock(getPos().up())) {
ParticleSmoke particleSmokeLarge = new ParticleSmoke(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0, 0.0D, 0);
particleSmokeLarge.setMaxAge(250);
if (color != EnumDyeColor.WHITE) {
float[] rgb = EntitySheep.getDyeRgb(color);
particleSmokeLarge.setRBGColorF(rgb[0] + (random.nextFloat() / 20), rgb[1] + (random.nextFloat() / 20), rgb[2] + (random.nextFloat() / 20));
particleSmokeLarge.setColor(rgb[0] + (random.nextFloat() / 20), rgb[1] + (random.nextFloat() / 20), rgb[2] + (random.nextFloat() / 20));
}
particleSmokeLarge.multipleParticleScaleBy(0.5F);

View file

@ -75,8 +75,8 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (!world.isRemote) {
charge(energySlot);
}

View file

@ -81,7 +81,7 @@ public class TileMachineCasing extends RectangularMultiblockTileEntityBase {
}
@Override
public void update() {
public void tick() {
}
}

View file

@ -133,12 +133,12 @@ public class TileMatterFabricator extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
public void tick() {
if (world.isRemote) {
return;
}
super.update();
super.tick();
this.charge(11);
for (int i = 0; i < 6; i++) {

View file

@ -62,9 +62,9 @@ public class TilePump extends TilePowerAcceptor {
}
@Override
public void update() {
super.update();
if (!world.isRemote && world.getTotalWorldTime() % 10 == 0 && !tank.isFull() && tank.getCapacity() - tank.getFluidAmount() >= 1000 && canUseEnergy(pumpExtractEU)) {
public void tick() {
super.tick();
if (!world.isRemote && world.getGameTime() % 10 == 0 && !tank.isFull() && tank.getCapacity() - tank.getFluidAmount() >= 1000 && canUseEnergy(pumpExtractEU)) {
FluidStack fluidStack = drainBlock(world, pos.down(), false);
if (fluidStack != null) {
tank.fill(drainBlock(world, pos.down(), true), true);
@ -102,7 +102,7 @@ public class TilePump extends TilePowerAcceptor {
return null;
}
if (doDrain) {
world.setBlockToAir(pos);
world.removeBlock(pos);
}
return new FluidStack(fluid, 1000);
}

View file

@ -77,8 +77,8 @@ public class TileQuantumTank extends TileMachineBase
// TileMachineBase
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (!world.isRemote) {
if (FluidUtils.drainContainers(tank, inventory, 0, 1)
|| FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType()))

View file

@ -128,8 +128,8 @@ public class TileTechStorageBase extends TileMachineBase
// TileMachineBase
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (!world.isRemote) {
ItemStack outputStack = ItemStack.EMPTY;
if (!inventory.getStackInSlot(1).isEmpty()) {

View file

@ -115,7 +115,7 @@ public class TileCable extends TileEntity
public void read(NBTTagCompound compound) {
super.read(compound);
if (compound.hasKey("TileCable")) {
power = compound.getCompoundTag("TileCable").getInt("power");
power = compound.getCompound("TileCable").getInt("power");
}
}
@ -153,7 +153,7 @@ public class TileCable extends TileEntity
}
ArrayList<IEnergyStorage> acceptors = new ArrayList<IEnergyStorage>();
for (EnumFacing face : EnumFacing.VALUES) {
for (EnumFacing face : EnumFacing.values()) {
TileEntity tile = world.getTileEntity(pos.offset(face));
if (tile == null) {

View file

@ -199,15 +199,15 @@ public class TileFusionControlComputer extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (world.isRemote) {
return;
}
// Force check every second
if (world.getTotalWorldTime() % 20 == 0) {
if (world.getGameTime() % 20 == 0) {
checkCoils();
inventory.setChanged();
}

View file

@ -68,8 +68,8 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
}
@Override
public void update() {
super.update();
public void tick() {
super.tick();
ticksSinceLastChange++;
if(world.isRemote){
@ -102,15 +102,15 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
final int currentWithdraw = (int) pendingWithdraw;
pendingWithdraw -= currentWithdraw;
tank.drain(currentWithdraw, true);
lastOutput = world.getTotalWorldTime();
lastOutput = world.getGameTime();
}
}
}
if (world.getTotalWorldTime() - lastOutput < 30 && !isActive()) {
if (world.getGameTime() - lastOutput < 30 && !isActive()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
}
else if (world.getTotalWorldTime() - lastOutput > 30 && isActive()) {
else if (world.getGameTime() - lastOutput > 30 && isActive()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
}
}

View file

@ -58,15 +58,15 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
}
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (onStatusHoldTicks > 0)
--onStatusHoldTicks;
if (onStatusHoldTicks == 0 || getEnergy() <= 0) {
if (getBlockType() instanceof BlockMachineBase)
((BlockMachineBase) getBlockType()).setActive(false, world, pos);
if (getBlockState().getBlock() instanceof BlockMachineBase)
((BlockMachineBase) getBlockState().getBlock()).setActive(false, world, pos);
onStatusHoldTicks = -1;
}

View file

@ -53,8 +53,8 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
// TilePowerAcceptor
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (world.isRemote) {
return;
}
@ -62,7 +62,7 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
setEnergy(Integer.MAX_VALUE);
return;
}
if (world.getTotalWorldTime() % 20 == 0) {
if (world.getGameTime() % 20 == 0) {
canSeeSky = world.canBlockSeeSky(pos.up());
if (lastState != isSunOut()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockSolarPanel.ACTIVE, isSunOut()));

View file

@ -70,19 +70,19 @@ public class TileDragonEggSyphon extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (!world.isRemote) {
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))
.getBlock() == Blocks.DRAGON_EGG) {
if (tryAddingEnergy(energyPerTick))
lastOutput = world.getTotalWorldTime();
lastOutput = world.getGameTime();
}
if (world.getTotalWorldTime() - lastOutput < 30 && !isActive()) {
if (world.getGameTime() - lastOutput < 30 && !isActive()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
} else if (world.getTotalWorldTime() - lastOutput > 30 && isActive()) {
} else if (world.getGameTime() - lastOutput > 30 && isActive()) {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
}
}

View file

@ -73,8 +73,8 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
}
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (world.isRemote) {
return;
}
@ -114,7 +114,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
final IBlockState BlockStateContainer = world.getBlockState(pos);
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != burnTime > 0) {
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != burnTime > 0) {
blockMachineBase.setActive(burnTime > 0, world, pos);
}
}

View file

@ -57,9 +57,9 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
}
@Override
public void update() {
super.update();
if (world.getTotalWorldTime() % 20 == 0) {
public void tick() {
super.tick();
if (world.getGameTime() % 20 == 0) {
checkForWater();
}
if (waterblocks > 0) {

View file

@ -55,8 +55,8 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
}
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (pos.getY() > 64) {
int actualPower = baseEnergy;
if (world.isThundering()) {

View file

@ -40,8 +40,8 @@ public class TileLamp extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (world == null || world.isRemote) {
return;
}

View file

@ -128,8 +128,8 @@ public class TileIronAlloyFurnace extends TileMachineBase
}
@Override
public void update() {
super.update();
public void tick() {
super.tick();
final boolean flag = this.burnTime > 0;
boolean flag1 = false;
if (this.burnTime > 0) {

View file

@ -68,8 +68,8 @@ public class TileIronFurnace extends TileMachineBase
}
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if(world.isRemote){
return;
}

View file

@ -63,8 +63,8 @@ public class TileEnergyStorage extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (!inventory.getStackInSlot(0).isEmpty()) {
ItemStack stack = inventory.getStackInSlot(0);

View file

@ -79,8 +79,8 @@ public class TileLSUStorage extends TileMachineBase
// TileMachineBase
@Override
public void update() {
super.update();
public void tick() {
super.tick();
if (network == null) {
findAndJoinNetwork(world, pos.getX(), pos.getY(), pos.getZ());
} else {

View file

@ -54,10 +54,10 @@ public class BehaviorDispenseScrapbox extends BehaviorDefaultDispenseItem {
List<IBaseRecipeType> scrapboxRecipeList = RecipeHandler.getRecipeClassFromName(Reference.SCRAPBOX_RECIPE);
int random = new Random().nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutput(0);
stack.splitStack(1);
stack.split(1);
TileEntityDispenser tile = source.getBlockTileEntity();
EnumFacing enumfacing = tile.getWorld().getBlockState(new BlockPos(source.getX(), source.getY(), source.getZ())).getValue(BlockDispenser.FACING);
EnumFacing enumfacing = tile.getWorld().getBlockState(new BlockPos(source.getX(), source.getY(), source.getZ())).get(BlockDispenser.FACING);
IPosition iposition = BlockDispenser.getDispensePosition(source);
doDispense(source.getWorld(), out, 6, enumfacing, iposition);
}

View file

@ -33,6 +33,7 @@ import net.minecraftforge.oredict.OreDictionary;
import javax.annotation.Nonnull;
import java.util.List;
@Deprecated //needs to go and be repalced by a version for tags. Has some other stuff that might be useful in another class so im not removing it just yet
public class OreDictUtils {
public static String toFirstLower(String string) {

View file

@ -29,6 +29,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -58,7 +59,7 @@ public class StackWIPHandler {
}
private void addHead(String name) {
ItemStack head = new ItemStack(Items.SKULL, 1, 3);
ItemStack head = new ItemStack(Items.PLAYER_HEAD, 3);
head.setTag(new NBTTagCompound());
head.getTag().setTag("SkullOwner", new NBTTagString(name));
devHeads.add(head);
@ -69,11 +70,11 @@ public class StackWIPHandler {
public void toolTip(ItemTooltipEvent event) {
Block block = Block.getBlockFromItem(event.getItemStack().getItem());
if (block != null && wipBlocks.contains(block)) {
event.getToolTip().add(TextFormatting.RED + StringUtils.t("techreborn.tooltip.wip"));
event.getToolTip().add(new TextComponentString(TextFormatting.RED + StringUtils.t("techreborn.tooltip.wip")));
}
if (devHeads.contains(event.getItemStack())) {
event.getToolTip().add(TextFormatting.GOLD + "TechReborn Developer");
event.getToolTip().add(new TextComponentString(TextFormatting.GOLD + "TechReborn Developer"));
}
}
}

View file

@ -26,6 +26,7 @@ package techreborn.world;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Sets;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -44,15 +45,15 @@ import java.util.Set;
*/
public class TechRebornRetroGen {
private static final String RETROGEN_TAG = "techrebonr:retogen";
private static final Set<ChunkCoord> completedChunks = Sets.newHashSet();
private final Deque<ChunkCoord> chunksToRetroGen = new ArrayDeque<>(64);
private static final Set<ChunkPos> completedChunks = Sets.newHashSet();
private final Deque<ChunkPos> chunksToRetroGen = new ArrayDeque<>(64);
private boolean isChunkEligibleForRetroGen(ChunkDataEvent.Load event) {
return TechReborn.worldGen.config.retroGenOres && event.getWorld().provider.getDimension() == 0
&& event.getData().getString(RETROGEN_TAG).isEmpty();
}
public void markChunk(ChunkCoord coord) {
public void markChunk(ChunkPos coord) {
completedChunks.add(coord);
}
@ -64,7 +65,7 @@ public class TechRebornRetroGen {
public void onWorldTick(TickEvent.WorldTickEvent event) {
if (isTickEligibleForRetroGen(event)) {
if (!chunksToRetroGen.isEmpty()) {
final ChunkCoord coord = chunksToRetroGen.pollFirst();
final ChunkPos coord = chunksToRetroGen.pollFirst();
TechReborn.LOGGER.info("Regenerating ore in " + coord + '.');
final World world = event.world;
if (world.getChunkProvider().getLoadedChunk(coord.getX(), coord.getZ()) != null) {
@ -83,7 +84,7 @@ public class TechRebornRetroGen {
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event) {
if (isChunkEligibleForRetroGen(event)) {
final ChunkCoord coord = ChunkCoord.of(event);
final ChunkPos coord = ChunkPos.of(event);
TechReborn.LOGGER.info("Queueing retro ore gen for " + coord + '.');
chunksToRetroGen.addLast(coord);
}
@ -91,7 +92,7 @@ public class TechRebornRetroGen {
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
final ChunkCoord coord = ChunkCoord.of(event);
final ChunkPos coord = ChunkPos.of(event);
if (completedChunks.contains(coord)) {
event.getData().setString(RETROGEN_TAG, "X");
completedChunks.remove(coord);

View file

@ -29,47 +29,50 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraft.world.gen.feature.structure.StructurePiece;
import net.minecraft.world.gen.feature.structure.VillagePieces;
import techreborn.init.TRContent;
import techreborn.world.RubberTreeGenerator;
import java.util.List;
import java.util.Random;
public class VillageComponentRubberPlantaion extends StructureVillagePieces.Field1 {
public class VillageComponentRubberPlantaion extends VillagePieces.Field1 {
public static StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 13, 4, 9, facing);
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new VillageComponentRubberPlantaion(startPiece, p5, random, structureboundingbox, facing) : null;
public static VillagePieces.Village buildComponent(VillagePieces.PieceWeight villagePiece, VillagePieces.Start startPiece, List<StructurePiece> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
MutableBoundingBox structureboundingbox = MutableBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 13, 4, 9, facing);
return canVillageGoDeeper(structureboundingbox) && StructurePiece.findIntersecting(pieces, structureboundingbox) == null ? new VillageComponentRubberPlantaion(startPiece, p5, random, structureboundingbox, facing) : null;
}
public VillageComponentRubberPlantaion() {
}
public VillageComponentRubberPlantaion(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox structureBoundingBox, EnumFacing facing) {
public VillageComponentRubberPlantaion(VillagePieces.Start start, int type, Random rand, MutableBoundingBox structureBoundingBox, EnumFacing facing) {
super(start, type, rand, structureBoundingBox, facing);
}
@Override
protected void fillWithBlocks(World worldIn, StructureBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockState boundaryBlockState, IBlockState insideBlockState, boolean existingOnly) {
protected void fillWithBlocks(IWorld worldIn, MutableBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockState boundaryBlockState, IBlockState insideBlockState, boolean existingOnly) {
//Replaces farmland with dirt, its not great but it works.
if (boundaryBlockState.getBlock() == Blocks.FARMLAND) {
boundaryBlockState = Blocks.GRASS.getDefaultState();
insideBlockState = Blocks.GRASS.getDefaultState();
}
//Replaces the water and logs with stone bricks
if (boundaryBlockState.getBlock() == Blocks.WATER || boundaryBlockState.getBlock() == Blocks.LOG) {
boundaryBlockState = Blocks.STONEBRICK.getDefaultState();
insideBlockState = Blocks.STONEBRICK.getDefaultState();
if (boundaryBlockState.getBlock() == Blocks.WATER || boundaryBlockState.getBlock() == Blocks.OAK_LOG) {
boundaryBlockState = Blocks.STONE_BRICKS.getDefaultState();
insideBlockState = Blocks.STONE_BRICKS.getDefaultState();
}
super.fillWithBlocks(worldIn, boundingboxIn, xMin, yMin, zMin, xMax, yMax, zMax, boundaryBlockState, insideBlockState, existingOnly);
}
@Override
protected void setBlockState(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn) {
protected void setBlockState(IWorld worldIn, IBlockState blockstateIn, int x, int y, int z, MutableBoundingBox boundingboxIn) {
if (isCrop(blockstateIn)) {
blockstateIn = TRContent.RUBBER_SAPLING.getDefaultState();
}
@ -77,8 +80,8 @@ public class VillageComponentRubberPlantaion extends StructureVillagePieces.Fiel
}
@Override
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) {
super.addComponentParts(worldIn, randomIn, structureBoundingBoxIn);
public boolean addComponentParts(IWorld worldIn, Random randomIn, MutableBoundingBox structureBoundingBoxIn, ChunkPos chunkPos) {
super.addComponentParts(worldIn, randomIn, structureBoundingBoxIn, chunkPos);
for (int i = 1; i < 7; i++) {
growRandom(i, 1, structureBoundingBoxIn, randomIn, worldIn);
growRandom(i, 2, structureBoundingBoxIn, randomIn, worldIn);
@ -93,7 +96,7 @@ public class VillageComponentRubberPlantaion extends StructureVillagePieces.Fiel
return true;
}
private void growRandom(int coloum, int row, StructureBoundingBox structureBoundingBox, Random random, World world) {
private void growRandom(int coloum, int row, MutableBoundingBox structureBoundingBox, Random random, World world) {
if (random.nextInt(10) == 0) {
setBlockState(world, Blocks.AIR.getDefaultState(), row, 1, coloum, structureBoundingBox);
BlockPos pos = new BlockPos(this.getXWithOffset(row, coloum), this.getYWithOffset(1), this.getZWithOffset(row, coloum));

View file

@ -25,6 +25,8 @@
package techreborn.world.village;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.feature.structure.StructurePiece;
import net.minecraft.world.gen.feature.structure.VillagePieces;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
@ -35,8 +37,8 @@ import java.util.Random;
public class VillagePlantaionHandler implements VillagerRegistry.IVillageCreationHandler {
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i) {
return new StructureVillagePieces.PieceWeight(VillageComponentRubberPlantaion.class, 5, 1);
public VillagePieces.PieceWeight getVillagePieceWeight(Random random, int i) {
return new StructurePiece.PieceWeight(VillageComponentRubberPlantaion.class, 5, 1);
}
@Override
@ -44,8 +46,9 @@ public class VillagePlantaionHandler implements VillagerRegistry.IVillageCreatio
return VillageComponentRubberPlantaion.class;
}
@Override
public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
public VillagePieces.Village buildComponent(VillagePieces.PieceWeight villagePiece, VillagePieces.Start startPiece, List<StructurePiece> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
return VillageComponentRubberPlantaion.buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, facing, p5);
}
}