experimental particle crap, watz item IO

This commit is contained in:
Boblet 2023-03-28 16:54:15 +02:00
parent 1cf051a8b1
commit cd319ef44d
5 changed files with 161 additions and 2 deletions

View File

@ -65,6 +65,7 @@ import com.hbm.handler.ImpactWorldHandler;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.items.ModItems;
import com.hbm.particle.*;
import com.hbm.particle.psys.engine.EventHandlerParticleEngine;
import com.hbm.render.anim.*;
import com.hbm.render.anim.HbmAnimations.Animation;
import com.hbm.render.block.*;
@ -115,6 +116,7 @@ public class ClientProxy extends ServerProxy {
registerClientEventHandler(new ModEventHandlerClient());
registerClientEventHandler(new ModEventHandlerRenderer());
registerClientEventHandler(new EventHandlerParticleEngine());
registerClientEventHandler(theInfoSystem);
AdvancedModelLoader.registerModelHandler(new HmfModelLoader());

View File

@ -0,0 +1,32 @@
package com.hbm.particle.psys.engine;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.world.WorldEvent;
@SideOnly(Side.CLIENT)
public class EventHandlerParticleEngine {
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
if(event.phase == event.phase.START) {
}
}
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event) {
float interp = event.partialTicks;
}
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
/* create new engine instance on every new world load (when joining servers, switching dimensions, etc), prevents particles from persisting between worlds */
ParticleEngine.INSTANCE = new ParticleEngine(event.world, Minecraft.getMinecraft().renderEngine);
}
}

View File

@ -0,0 +1,32 @@
package com.hbm.particle.psys.engine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.world.World;
/**
* HBM: reinventing the fucking wheel for the 15th time since 2014
*
* @author hbm
*/
@SideOnly(Side.CLIENT)
public class PSysFX {
public World world;
public double posX;
public double posY;
public double posZ;
public double prevPosX;
public double prevPosY;
public double prevPosZ;
public double motionX;
public double motionY;
public double motionZ;
public static double interpPosX;
public static double interpPosY;
public static double interpPosZ;
public PSysFX() {
}
}

View File

@ -0,0 +1,58 @@
package com.hbm.particle.psys.engine;
import java.util.List;
import java.util.Random;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class ParticleEngine {
public static ParticleEngine INSTANCE;
public World world;
public TextureManager texman;
public FXLayer[] layers;
protected Random rand = new Random();
public ParticleEngine(World world, TextureManager texman) {
this.world = world;
this.texman = texman;
setupLayers();
}
private void setupLayers() {
layers = new FXLayer[] {
};
}
public void updateParticles() {
}
public void renderParticles(float interp) {
}
public static class FXLayer {
protected ResourceLocation batchTexture;
protected List particles;
public FXLayer() { }
public FXLayer(ResourceLocation batchTexture) {
this.batchTexture = batchTexture;
}
protected void updateLayer() {
}
protected void renderLayer() {
}
}
}

View File

@ -3,6 +3,7 @@ package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerWatz;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
@ -32,7 +33,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityWatz extends TileEntityMachineBase implements IFluidStandardTransceiver, IGUIProvider {
public class TileEntityWatz extends TileEntityMachineBase implements IFluidStandardTransceiver, IControlReceiver, IGUIProvider {
public FluidTank[] tanks;
public int heat;
@ -42,10 +43,11 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
/* lock types for item IO */
public boolean isLocked = false;
public ItemStack[] locks = new ItemStack[24];
public ItemStack[] locks;
public TileEntityWatz() {
super(24);
this.locks = new ItemStack[slots.length];
this.tanks = new FluidTank[3];
this.tanks[0] = new FluidTank(Fluids.COOLANT, 64_000);
this.tanks[1] = new FluidTank(Fluids.COOLANT_HOT, 64_000);
@ -280,10 +282,43 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
}
}
@Override
public boolean hasPermission(EntityPlayer player) {
return this.isUseableByPlayer(player);
}
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("lock")) {
if(this.isLocked) {
this.locks = new ItemStack[slots.length];
} else {
for(int i = 0; i < slots.length; i++) {
this.locks[i] = slots[i];
}
}
this.isLocked = !this.isLocked;
this.markChanged();
}
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
return stack.getItem() == ModItems.watz_pellet;
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
}
@Override
public boolean canExtractItem(int i, ItemStack stack, int j) {
return stack.getItem() != ModItems.watz_pellet;
}
@Override
public int getInventoryStackLimit() {