Fixes anchor rendering (#2698)

* Fixes #2680: Use a shorter cable anchor model when blocked by a facade.
* Fixes #2664: Prevent anchors from creating intersection.

Replaced the simple List<ResourceLocation> for the static models with a
new container also indicating a solid part, which can be used to prevent
the creation of an intersection.
This commit is contained in:
yueh
2016-12-14 22:37:10 +01:00
committed by GitHub
parent 8bed7f223e
commit a14cf2204d
74 changed files with 525 additions and 320 deletions
+15 -14
View File
@@ -22,11 +22,11 @@ package appeng.parts.p2p;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.parts.PartModel;
/**
@@ -39,19 +39,19 @@ class P2PModels
public static final ResourceLocation MODEL_STATUS_ON = new ResourceLocation( AppEng.MOD_ID, "part/p2p/p2p_tunnel_status_on" );
public static final ResourceLocation MODEL_STATUS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/p2p/p2p_tunnel_status_has_channel" );
private final List<ResourceLocation> modelsOff;
private final List<ResourceLocation> modelsOn;
private final List<ResourceLocation> modelsHasChannel;
private final IPartModel modelsOff;
private final IPartModel modelsOn;
private final IPartModel modelsHasChannel;
public P2PModels( String frontModelPath )
{
ResourceLocation frontModel = new ResourceLocation( AppEng.MOD_ID, frontModelPath );
modelsOff = ImmutableList.of( MODEL_STATUS_OFF, frontModel );
modelsOn = ImmutableList.of( MODEL_STATUS_ON, frontModel );
modelsHasChannel = ImmutableList.of( MODEL_STATUS_HAS_CHANNEL, frontModel );
modelsOff = new PartModel( MODEL_STATUS_OFF, frontModel );
modelsOn = new PartModel( MODEL_STATUS_ON, frontModel );
modelsHasChannel = new PartModel( MODEL_STATUS_HAS_CHANNEL, frontModel );
}
public List<ResourceLocation> getModel( boolean hasPower, boolean hasChannel )
public IPartModel getModel( boolean hasPower, boolean hasChannel )
{
if( hasPower && hasChannel )
{
@@ -67,11 +67,12 @@ class P2PModels
}
}
public List<ResourceLocation> getModels() {
List<ResourceLocation> result = new ArrayList<>();
result.addAll( modelsOff );
result.addAll( modelsOn );
result.addAll( modelsHasChannel );
public List<IPartModel> getModels()
{
List<IPartModel> result = new ArrayList<>();
result.add( modelsOff );
result.add( modelsOn );
result.add( modelsHasChannel );
return result;
}