Skip to content

Commit

Permalink
Candelbras, candelilla, client binding stuff, it's a ton.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaquadro committed Dec 6, 2015
1 parent b9b153a commit 3e9a3d8
Show file tree
Hide file tree
Showing 47 changed files with 1,254 additions and 164 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repositories {

apply plugin: 'forge'

version = "1.7.10-1.6.6"
version = "1.7.10-1.7.0"
group= "com.jaquadro.gardenstuff" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "GardenStuff"

Expand Down
Binary file added resources/assets/gardencore/textures/items/wax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"credits": "By jaquadro",
"logoFile": "",
"url": "http://www.jaquadro.com/",
"authors": [ "jaquadro" ]
"authors": [ "jaquadro" ],
"dependencies": [ "AgriCraft" ],
"useDependencyInformation": "true"
},
{
"modid": "GardenCore",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.jaquadro.minecraft.gardenapi.api.connect.StandardAttachable;
import com.jaquadro.minecraft.gardencore.util.UniqueMetaIdentifier;
import com.jaquadro.minecraft.gardencore.util.UniqueMetaRegistry;
import com.jaquadro.minecraft.gardenstuff.core.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
Expand All @@ -28,6 +29,8 @@ private void init () {
registerAttachable(Blocks.stone_slab, i, StandardAttachable.createBottom(0.5));
registerAttachable(Blocks.wooden_slab, i, StandardAttachable.createBottom(0.5));
}

registerAttachable(ModBlocks.candelabra, StandardAttachable.createBottom(0.0625));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public void bindSlot (World world, int x, int y, int z, TileEntityGarden te, int
if (getPlantBlock(te, slot) != null)
data = getPlantData(te, slot);

GardenCore.proxy.getBindingStack(this).bind(world, x, y, z, slot, data);
GardenCore.proxy.getBindingStack(world, this).bind(world, x, y, z, slot, data);
}

public void unbindSlot (World world, int x, int y, int z, TileEntityGarden te) {
GardenCore.proxy.getBindingStack(this).unbind(world, x, y, z);
GardenCore.proxy.getBindingStack(world, this).unbind(world, x, y, z);
}

@Override
Expand Down Expand Up @@ -523,7 +523,7 @@ public void randomDisplayTick (World world, int x, int y, int z, Random random)
@SideOnly(Side.CLIENT)
@Override
public int colorMultiplier (IBlockAccess blockAccess, int x, int y, int z) {
int slot = GardenCore.proxy.getBindingStack(this).getSlot();
int slot = GardenCore.proxy.getClientBindingStack(this).getSlot();
TileEntityGarden te = getGardenEntity(blockAccess, x, y, z);
if (te == null || slot == -1)
return super.colorMultiplier(blockAccess, x, y, z);
Expand All @@ -543,7 +543,7 @@ public int colorMultiplier (IBlockAccess blockAccess, int x, int y, int z) {
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon (IBlockAccess blockAccess, int x, int y, int z, int side) {
int slot = GardenCore.proxy.getBindingStack(this).getSlot();
int slot = GardenCore.proxy.getClientBindingStack(this).getSlot();
TileEntityGarden te = getGardenEntity(blockAccess, x, y, z);
if (te == null || slot == -1)
return super.getIcon(blockAccess, x, y, z, side);
Expand Down
11 changes: 0 additions & 11 deletions src/com/jaquadro/minecraft/gardencore/core/ClientProxy.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package com.jaquadro.minecraft.gardencore.core;

import com.jaquadro.minecraft.gardencore.client.renderer.*;
import com.jaquadro.minecraft.gardencore.util.BindingStack;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;

import java.util.HashMap;
import java.util.Map;

public class ClientProxy extends CommonProxy
{
public static int renderPass = 0;
Expand All @@ -20,8 +16,6 @@ public class ClientProxy extends CommonProxy
public static ISimpleBlockRenderingHandler smallFireRenderer;
public static ISimpleBlockRenderingHandler compostBinRenderer;

private Map<Object, BindingStack> bindingStacks = new HashMap<Object, BindingStack>();

@Override
public void registerRenderers ()
{
Expand All @@ -37,9 +31,4 @@ public void registerRenderers ()
RenderingRegistry.registerBlockHandler(smallFireRenderID, smallFireRenderer);
RenderingRegistry.registerBlockHandler(compostBinRenderID, compostBinRenderer);
}

@Override
protected Map<Object, BindingStack> getBindingRegistry () {
return bindingStacks;
}
}
23 changes: 17 additions & 6 deletions src/com/jaquadro/minecraft/gardencore/core/CommonProxy.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
package com.jaquadro.minecraft.gardencore.core;

import com.jaquadro.minecraft.gardencore.util.BindingStack;
import net.minecraft.world.World;

import java.util.HashMap;
import java.util.Map;

public abstract class CommonProxy
public class CommonProxy
{
private Map<Object, BindingStack> bindingStacksClient = new HashMap<Object, BindingStack>();
private Map<Object, BindingStack> bindingStacksServer = new HashMap<Object, BindingStack>();

public void registerRenderers ()
{ }

public void postInit () {
registerBindingStack(ModBlocks.gardenProxy);
}

protected abstract Map<Object, BindingStack> getBindingRegistry ();

public void registerBindingStack (Object object) {
getBindingRegistry().put(object, new BindingStack());
bindingStacksClient.put(object, new BindingStack());
bindingStacksServer.put(object, new BindingStack());
}

public BindingStack getClientBindingStack (Object object) {
return bindingStacksClient.get(object);
}

public BindingStack getBindingStack (Object object) {
return getBindingRegistry().get(object);
public BindingStack getBindingStack (World world, Object object) {
if (world.isRemote)
return bindingStacksClient.get(object);
else
return bindingStacksServer.get(object);
}
}

7 changes: 7 additions & 0 deletions src/com/jaquadro/minecraft/gardencore/core/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,31 @@
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public class ModItems
{
public static Item gardenTrowel;
public static ItemSoilKit soilTestKit;
public static ItemUsedSoilKit usedSoilTestKit;
public static Item compostPile;
public static Item wax;

public void init () {
gardenTrowel = new ItemTrowel(makeName("gardenTrowel"), Item.ToolMaterial.IRON);
soilTestKit = new ItemSoilKit(makeName("soilTestKit"));
usedSoilTestKit = new ItemUsedSoilKit(makeName("soilTestKitUsed"));
compostPile = new ItemCompost(makeName("compostPile"));
wax = new Item().setUnlocalizedName(makeName("wax")).setCreativeTab(ModCreativeTabs.tabGardenCore).setTextureName(GardenCore.MOD_ID + ":wax");

GameRegistry.registerItem(gardenTrowel, "garden_trowel");
GameRegistry.registerItem(compostPile, "compost_pile");
GameRegistry.registerItem(soilTestKit, "soil_test_kit");
GameRegistry.registerItem(usedSoilTestKit, "soil_test_kit_used");
GameRegistry.registerItem(wax, "wax");

OreDictionary.registerOre("materialWax", wax);
OreDictionary.registerOre("materialPressedWax", wax);
}

public static String makeName (String name) {
Expand Down
11 changes: 0 additions & 11 deletions src/com/jaquadro/minecraft/gardencore/core/ServerProxy.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
package com.jaquadro.minecraft.gardencore.core;

import com.jaquadro.minecraft.gardencore.util.BindingStack;

import java.util.HashMap;
import java.util.Map;

public class ServerProxy extends CommonProxy
{
private Map<Object, BindingStack> bindingStacks = new HashMap<Object, BindingStack>();

@Override
protected Map<Object, BindingStack> getBindingRegistry () {
return bindingStacks;
}
}
27 changes: 24 additions & 3 deletions src/com/jaquadro/minecraft/gardencore/util/RenderHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ public void setRenderBounds (Block block) {
setRenderBounds(block.getBlockBoundsMinX(), block.getBlockBoundsMinY(), block.getBlockBoundsMinZ(), block.getBlockBoundsMaxX(), block.getBlockBoundsMaxY(), block.getBlockBoundsMaxZ());
}

public void setColorAndBrightness (IBlockAccess blockAccess, Block block, int x, int y, int z) {
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));

calculateBaseColor(colorScratch, block.colorMultiplier(blockAccess, x, y, z));
setTessellatorColor(tessellator, colorScratch);
}

public void renderBlock (IBlockAccess blockAccess, Block block, int meta) {
calculateBaseColor(colorScratch, block.getRenderColor(meta));
float r = colorScratch[0];
Expand Down Expand Up @@ -143,15 +151,18 @@ public void renderFace (int face, IBlockAccess blockAccess, Block block, int x,
public void renderFaceColorMult (int face, IBlockAccess blockAccess, Block block, int x, int y, int z, IIcon icon, float r, float g, float b) {
setupColorMult(face, blockAccess, block, x, y, z, r, g, b);

face = RenderHelperState.FACE_BY_FACE_ROTATION[face][state.rotateTransform];
llHelper.drawFace(face, x, y, z, icon);

if (blockAccess == null)
Tessellator.instance.draw();
}

public void renderFaceAOPartial (int face, IBlockAccess blockAccess, Block block, int x, int y, int z, IIcon icon, float r, float g, float b) {
state.enableAO = true;

face = RenderHelperState.FACE_BY_FACE_ROTATION[face][state.rotateTransform];

switch (face) {
case YNEG:
aoHelper.setupYNegAOPartial(blockAccess, block, x, y, z, r, g, b);
Expand Down Expand Up @@ -208,7 +219,7 @@ public void renderPartialFaceColorMult (int face, IBlockAccess blockAccess, Bloc
public void renderPartialFaceAOPartial (int face, IBlockAccess blockAccess, Block block, int x, int y, int z, IIcon icon, double uMin, double vMin, double uMax, double vMax, float r, float g, float b) {
state.enableAO = true;

switch (face) {
switch (RenderHelperState.FACE_BY_FACE_ROTATION[face][state.rotateTransform]) {
case YNEG:
aoHelper.setupYNegAOPartial(blockAccess, block, x, y, z, r, g, b);
break;
Expand All @@ -235,10 +246,12 @@ public void renderPartialFaceAOPartial (int face, IBlockAccess blockAccess, Bloc

public void renderPartialFace (int face, IIcon icon, double uMin, double vMin, double uMax, double vMax) {
state.enableAO = false;
face = RenderHelperState.FACE_BY_FACE_ROTATION[face][state.rotateTransform];
llHelper.drawPartialFace(face, 0, 0, 0, icon, uMin, vMin, uMax, vMax);
}

public void renderPartialFace (int face, double x, double y, double z, IIcon icon, double uMin, double vMin, double uMax, double vMax) {
face = RenderHelperState.FACE_BY_FACE_ROTATION[face][state.rotateTransform];
llHelper.drawPartialFace(face, x, y, z, icon, uMin, vMin, uMax, vMax);
}

Expand Down Expand Up @@ -284,6 +297,10 @@ public void drawCrossedSquares(IIcon icon, double x, double y, double z, float s
{
Tessellator tessellator = Tessellator.instance;

x += state.renderOffsetX;
y += state.renderOffsetY;
z += state.renderOffsetZ;

double uMin = icon.getInterpolatedU(state.renderMinX * 16.0D);
double uMax = icon.getInterpolatedU(state.renderMaxX * 16.0D);
double vMin = icon.getInterpolatedV(16 - state.renderMaxY * 16.0D);
Expand Down Expand Up @@ -320,6 +337,10 @@ public void drawCrossedSquaresBounded(IIcon icon, double x, double y, double z,
{
Tessellator tessellator = Tessellator.instance;

x += state.renderOffsetX;
y += state.renderOffsetY;
z += state.renderOffsetZ;

double vMin = icon.getInterpolatedV(16 - state.renderMaxY * 16.0D);
double vMax = icon.getInterpolatedV(16 - state.renderMinY * 16.0D);

Expand Down Expand Up @@ -420,7 +441,7 @@ private IIcon getBlockIconFromSideAndMetadata (Block block, int side, int meta)

private IIcon getIconSafe (IIcon icon) {
if (icon == null)
return ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");

return icon;
}
Expand Down
Loading

0 comments on commit 3e9a3d8

Please sign in to comment.