Files
TinkersConstruct/src/main/java/tconstruct/world/TinkerWorldProxyClient.java
T
Raven Szewczyk 39be06c23b Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items

fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392>

* Change 0-sized ItemStacks into null stacks in crafting station attached slots

Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425>

* Update buildscript

* spotlessApply
2022-09-22 20:51:23 +02:00

220 lines
12 KiB
Java

package tconstruct.world;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
import mantle.lib.client.MantleClientRegistry;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.particle.*;
import net.minecraft.init.*;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import tconstruct.mechworks.model.CartRender;
import tconstruct.tools.TinkerTools;
import tconstruct.world.entity.*;
import tconstruct.world.model.*;
public class TinkerWorldProxyClient extends TinkerWorldProxyCommon {
@Override
public void initialize() {
registerRenderer();
registerManualIcons();
registerManualRecipes();
}
void registerRenderer() {
RenderingRegistry.registerBlockHandler(new OreberryRender());
RenderingRegistry.registerBlockHandler(new BarricadeRender());
RenderingRegistry.registerBlockHandler(new RenderLandmine());
RenderingRegistry.registerBlockHandler(new PunjiRender());
RenderingRegistry.registerBlockHandler(new SlimeChannelRender());
RenderingRegistry.registerBlockHandler(new SlimePadRender());
// Entities
SlimeRender slimeRender = new SlimeRender(new ModelSlime(16), new ModelSlime(0), 0.25F);
RenderingRegistry.registerEntityRenderingHandler(BlueSlime.class, slimeRender);
RenderingRegistry.registerEntityRenderingHandler(KingBlueSlime.class, slimeRender);
RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender());
VillagerRegistry.instance()
.registerVillagerSkin(78943, new ResourceLocation("tinker", "textures/mob/villagertools.png"));
}
void registerManualIcons() {}
void registerManualRecipes() {
ItemStack netherrack = new ItemStack(Blocks.netherrack);
ItemStack coal = new ItemStack(Items.coal);
ItemStack log = new ItemStack(Blocks.log, 1, 0);
ItemStack graveyardsoil = new ItemStack(TinkerTools.craftedSoil, 1, 3);
ItemStack consecratedsoil = new ItemStack(TinkerTools.craftedSoil, 1, 4);
MantleClientRegistry.registerManualSmallRecipe(
"slimechannel",
new ItemStack(TinkerWorld.slimeChannel, 1, 0),
new ItemStack(TinkerWorld.slimeGel, 1, 0),
new ItemStack(Items.redstone),
null,
null);
MantleClientRegistry.registerManualSmallRecipe(
"bouncepad",
new ItemStack(TinkerWorld.slimePad, 1, 0),
new ItemStack(TinkerWorld.slimeChannel),
new ItemStack(Items.slime_ball),
null,
null);
MantleClientRegistry.registerManualSmallRecipe(
"graveyardsoil",
graveyardsoil,
new ItemStack(Blocks.dirt),
new ItemStack(Items.rotten_flesh),
new ItemStack(Items.dye, 1, 15),
null);
MantleClientRegistry.registerManualFurnaceRecipe("consecratedsoil", consecratedsoil, graveyardsoil);
// Traps
ItemStack reed = new ItemStack(Items.reeds);
MantleClientRegistry.registerManualLargeRecipe(
"punji", new ItemStack(TinkerWorld.punji, 5), reed, null, reed, null, reed, null, reed, null, reed);
MantleClientRegistry.registerManualSmallRecipe(
"barricade", new ItemStack(TinkerWorld.barricadeOak), null, log, null, log);
}
Minecraft mc = Minecraft.getMinecraft();
@Override
public void spawnParticle(
String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ) {
this.doSpawnParticle(particle, xPos, yPos, zPos, velX, velY, velZ);
}
public EntityFX doSpawnParticle(
String par1Str, double par2, double par4, double par6, double par8, double par10, double par12) {
if (this.mc == null) this.mc = Minecraft.getMinecraft();
if (this.mc.renderViewEntity != null && this.mc.effectRenderer != null) {
int i = this.mc.gameSettings.particleSetting;
if (i == 1 && mc.theWorld.rand.nextInt(3) == 0) {
i = 2;
}
double d6 = this.mc.renderViewEntity.posX - par2;
double d7 = this.mc.renderViewEntity.posY - par4;
double d8 = this.mc.renderViewEntity.posZ - par6;
EntityFX entityfx = null;
if (par1Str.equals("hugeexplosion")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
} else if (par1Str.equals("largeexplode")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityLargeExplodeFX(
mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
} else if (par1Str.equals("fireworksSpark")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityFireworkSparkFX(
mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
}
if (entityfx != null) {
return (EntityFX) entityfx;
} else {
double d9 = 16.0D;
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9) {
return null;
} else if (i > 1) {
return null;
} else {
if (par1Str.equals("bubble")) {
entityfx = new EntityBubbleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("suspended")) {
entityfx = new EntitySuspendFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("depthsuspend")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("townaura")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("crit")) {
entityfx = new EntityCritFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("smoke")) {
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("mobSpell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
} else if (par1Str.equals("mobSpellAmbient")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setAlphaF(0.15F);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
} else if (par1Str.equals("spell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("instantSpell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
} else if (par1Str.equals("witchMagic")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
float f = mc.theWorld.rand.nextFloat() * 0.5F + 0.35F;
((EntityFX) entityfx).setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
} else if (par1Str.equals("note")) {
entityfx = new EntityNoteFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("portal")) {
entityfx = new EntityPortalFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("enchantmenttable")) {
entityfx =
new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("explode")) {
entityfx = new EntityExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("flame")) {
entityfx = new EntityFlameFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("lava")) {
entityfx = new EntityLavaFX(mc.theWorld, par2, par4, par6);
} else if (par1Str.equals("footstep")) {
entityfx = new EntityFootStepFX(mc.renderEngine, mc.theWorld, par2, par4, par6);
} else if (par1Str.equals("splash")) {
entityfx = new EntitySplashFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("largesmoke")) {
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12, 2.5F);
} else if (par1Str.equals("cloud")) {
entityfx = new EntityCloudFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("reddust")) {
entityfx = new EntityReddustFX(
mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
} else if (par1Str.equals("snowballpoof")) {
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, Items.snowball);
} else if (par1Str.equals("dripWater")) {
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.water);
} else if (par1Str.equals("dripLava")) {
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.lava);
} else if (par1Str.equals("snowshovel")) {
entityfx = new EntitySnowShovelFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("blueslime")) {
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, TinkerWorld.strangeFood);
} else if (par1Str.equals("heart")) {
entityfx = new EntityHeartFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("angryVillager")) {
entityfx = new EntityHeartFX(mc.theWorld, par2, par4 + 0.5D, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(81);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
} else if (par1Str.equals("happyVillager")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(82);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
}
if (entityfx != null) {
this.mc.effectRenderer.addEffect((EntityFX) entityfx);
}
return (EntityFX) entityfx;
}
}
} else {
return null;
}
}
}